Giter Club home page Giter Club logo

github-codeowners's People

Contributors

fauxfaux avatar jjmschofield avatar snyk-bot avatar t0rat0ra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

github-codeowners's Issues

files with multiple dots in the file name not matched

I'm told I have a validation error:

$ github-codeowners validate
Found rules which did not match any files [
  '/test.en.yml @org/team',
]

But in reality the file exists:

$ ls test.en.yml
test.en.yml

Had a browse around the codebase and didn't spot the bug, sorry.

Validate: Can't use unix pipes or return code

$ github-codeowners validate
Found rules which did not match any files [
  '/some_file.yml @team'
]
$ echo $?
0

I would have expected this to return an error.

Further I tried to work around this by using wc -l but no dice:

$ github-codeowners validate | wc -l
Found rules which did not match any files [
  '/some_file.yml @team'
]
       0

Error when using -s and -g flags and a submodule is present

Steps to reproduce

  • In a git repo, add a submodule
  • run github-codeowners audit -s -g
  • See the error message:
failed to read lines from file github-codeowners [Error: EISDIR: illegal operation on a directory, read]

Output from terminal

image

Expected behavior

Ownership stats should be shown as expected without any error.
Submodules should be excluded, or included via a new parameter.

Incorrect handling of wildcard and subdirectories

It is possible to "fool" this library into thinking a file is covered by codeowners, whilst GitHub will not apply code ownership.

Steps to reproduce

  • Create a file in some nested subdirectory, e.g. /foo/bar/baz.txt
  • Add a rule involving a wildcard to CODEOWNERS e.g. /foo/* or /foo/b*
  • Run github-codeowners audit

Expected

  • The file is considered unloved

Actual

  • The file is considered loved

Notes

I've tested this scenario by raising a PR (in a private repo), and GitHub did not assign any code owners.

git: option to exclude deleted files

I'm using this as a CI step to require explicit owners for a monolith owned by multiple teams. Currently the CI step will fail if someone deletes a file that didn't have an explicit owner. This is obviously not desirable.

It would be nice to have an option like:

github-codeowners git --exclude-deleted-files develop HEAD

This way the CI can enforce that all new or modified files have owners.

library interface

Offer up a dependable interface so that other apps / scripts can consume the core functionality

feat: audit unloved should support explicitly unowned

Hey @jjmschofield, thanks much for this awesome library! ๐Ÿ’ฏ Are you currently accepting contributions? And if so, would you possibly have time to review, merge, and publish? If not, I understand - I'm happy to fork.

I'd love for github-codeowners audit --unloved to support the use case of explicitly marking some files as unowned. My use case is basically to enforce 100% CODEOWNERS coverage by ensuring this command has no output, but then allowing some known exceptions to be explicitly listed in the CODEOWNERS file.

GitHub appears to support this: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#:~:text=owners%20are%20left%20empty

# In this example, @octocat owns any file in the /apps
# directory in the root of your repository except for the /apps/github
# subdirectory, as its owners are left empty.
/apps/ @octocat
/apps/github

Historically I'd been using @ghost entries, but GitHub's recent feature to present a UI for validation of files shows errors because that is not a real team.

Bug: Currently owners are augmented

If multiple lines define ownership for a file then the owners are augmented.

The expected result would be that the later definitions overwrites earlier ones as stated here: codeowners-syntax

This is especially wrong for * ownerships.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.