github-codeowners's People
Forkers
jjmschofield-2 fauxfaux mrded r4d1um t0rat0ra santiagodiaz andersdjohnson yankaindustries sjdave alayacare congsun ankorstore reddit kohofinancial lukealbao mnyarady-wellgithub-codeowners's Issues
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.
add tests
add a version command
add better error handling when no CODEOWNERS
library interface
Offer up a dependable interface so that other apps / scripts can consume the core functionality
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.
validate should not allow inline comments
As per:
"Invalid syntax includes inline comments and user or team names that do not exist on GitHub."
https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
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.
add unit tests
publish from ci
nested gitignore support
Currently only the root .gitignore
is respected
symlinks break directory reading
Despite wide usage, maintainer of underlying lib is seems to no longer be maintaining jergason/recursive-readdir#60
Replace lib.
create specific stats command
add shared ownership stats
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
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.
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
Expected behavior
Ownership stats should be shown as expected without any error.
Submodules should be excluded, or included via a new parameter.
avoid counting lines if the config doesn't require a line count
prevents loading files into memory if not required, perf improvement suggestion from @FauxFaux
add support for stats buckets
support a whitelist of owners for validate
To help people support the schema at https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
Where in:
"Invalid syntax includes inline comments and user or team names that do not exist on GitHub."
In a config (somehwere, somehow) create a list of allowed owners and make the validate
command respect it.
{
...
"validate":{
...
"owners": {
"allowed": [
"@bob"
]
}
}
}
Add validation for owner names
Add a regex check when reading in code owners to ensure that owner names are valid for github.
Github has two potential formats for an owner which are valid:
[email protected]
@js-owner
https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
add integration tests
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.
Owners list ordering in audit output could be improved
It currently seems a bit random. I think alphabetically by team name is a good start. Other ideas are by number of files owned.
setup ci
support multiple files on the who command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.