-
Notifications
You must be signed in to change notification settings - Fork 58
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
Fail On Duplicate Config Names #1372
Fail On Duplicate Config Names #1372
Conversation
@@ -0,0 +1,3 @@ | |||
package: | |||
name: foo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might also want to fail if .package.name
is not the same as the filename.
These are potentially different/separate issues, but it does I think violate some assumptions we've made, and is worth avoiding.
If we have that check, we also get uniqueness "for free" since there can't be two foo.yaml
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the .package.name field must match the filename, couldn't you make an argument that the field is redundant and should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check to error if the config name does not match the package name. This makes it impossible to test the package duplicate logic because, as you said, this gives us uniqueness for free, but I left the original check in just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably is redundant, but I don't think we can easily remove it without causing lots and lots of downstream effects. I think it's fine to leave it, and just ensure it's the same as the filename, for now.
…age name matches the file name.
Looks like there are some linting errors for extra whitespace in the file, just need to clean that up and this should be ready to merge! |
…olfictl into paulgibert/block-duplicates
Nice! |
Fixes #1599
wolfictl lint
to fail if a duplicate package config name is encountered.melange_test.go
for duplicate package config namesSteps to test:
lint
succeeds on a valid repo:The check happens in
pkg/melange
as this is where the duplicates were ignored as pointed out in #1599. An alternative but more complex solution would be to add a new lint rule. I didn't go that route because it would require a notable ABI change.#first-golang-pr (let's go)
@priyawadhwa