-
Notifications
You must be signed in to change notification settings - Fork 269
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
Set top-level LintConfig
and BreakingConfig
and use for image inputs
#3111
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a6a8dac
Set top-level lint and breaking configs a defaults for v2 buf.yaml
doriable a657483
v2 default lint config should allow comment ignores
doriable 1b5e809
Address comments
doriable 4d71dc2
Apply suggestions from code review
doriable 039bd18
Switch logic to top-level module config
doriable 2823e3f
Fix lint
doriable c767e16
Merge remote-tracking branch 'origin/main' into 3080-v2-buf-yaml-defa…
doriable 30e4286
Use LintConfig and BreakingConfig instead
doriable File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ var ( | |
false, | ||
false, | ||
"", | ||
false, | ||
true, // We default to allowing comment ignores in v2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pkwarren caught an issue with the default
|
||
) | ||
) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This isn't actually correct - this is just choosing a single configuration among potentially many and calling it the default, which is what we've tried to avoid pretty consistently with v2. I think what you're actually looking for in this PR is some concept of "if there is a single configuration, give it to me, otherwise tell me it is not present". What this logic looks like:
If you get false, do nothing, as we do right now.
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.
So if a user passes the following file to
--config
:Wouldn't we want them to pick up the top-level configs for the default in the case of:
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.
We'd probably want to error, or at least print a warning along the lines of:
I could see an argument to also modify the logic to "if >1 modules, return the top-level module", but that may just leave us open to even more support stuff in the long-term.
Going a different direction, we could take the position that for image inputs only, we always take the top-level configuration, and never look into specific module configs. This would mean that if you had the following:
The
modules[0].LintConfig
would not be picked up and propagated. The position here would be that module-specific configuration never applies to an image, and we treat configuration for an image as if it were a "new" module in themodules
list.This may be what
moduleConfigs[0]
does in practice for v1, but not for v2, but I'd also be comfortable with adopting this position, it seems intellectually consistent.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 am a fan of the latter approach for images. For
v1
, the behaviour will stay the same since there should only ever be a single lint/breaking config. Forv2
, we check for a top-level config, and if nothing is there, then we would use whatever the version defaults are. And yes, in the case you provided, where there is a single module,path: .
, that would not be considered the default configuration. Changes incoming.