Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce only one CODEOWNERS file #100

Merged
merged 2 commits into from
Feb 9, 2022

Conversation

athtran
Copy link
Contributor

@athtran athtran commented Nov 18, 2021

Description

codeowners-validator currently allows multiple codeowners files, grabbing the first one it finds. There is no valid use for codeowners files in multiple places.

This PR enforces only one codeowners file

Related issue(s)

Resolves #97

Copy link
Owner

@mszostok mszostok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 🙇

To don't waste your time, I will adjust the implementation in a separate commit.

if fileReader != nil {
return nil, fmt.Errorf("Multiple CODEOWNERS files found in root, docs/, or .github/ directory of the repository %s", dir)
}
fileReader, err = fs.Open(f)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing error handling, errors related to opening a file will be silenced


return fs.Open(f)
if fileReader != nil {
return nil, fmt.Errorf("Multiple CODEOWNERS files found in root, docs/, or .github/ directory of the repository %s", dir)
Copy link
Owner

@mszostok mszostok Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to tell where we spot those duplications exactly

@mszostok mszostok merged commit add91fe into mszostok:main Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate that only a single CODEOWNERS file exists in the repository
2 participants