-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
enforce nolint scope #34851
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
Merged
Merged
enforce nolint scope #34851
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2822a5e
scope nolint directive in migrations
TheFox0x7 d66c142
scope nolint directive for underscore in packages
TheFox0x7 3752045
scope nolint directives for export stutters
TheFox0x7 05e2ad5
scope nolint directives for deprecated fields and functions
TheFox0x7 984e837
fix nolint directives which aren't guarding anything significant
TheFox0x7 305cbdb
enforce nolint scope
TheFox0x7 1849401
restore testifylint supression, change gocritic comment to explanation
TheFox0x7 d10e0d3
shorter comment
wxiaoguang 5b32025
rewrite TestCleanUploadFileName to avoid nolint
wxiaoguang 1aa47b0
shorter comment for "export stutter"
wxiaoguang 08f5873
Merge branch 'main' into nolintlint-flags
wxiaoguang ccd1950
drop underscore nolint directive
TheFox0x7 482ac72
fix comments
TheFox0x7 80b05b7
mark var-naming related revive ignores
TheFox0x7 1c00b23
Merge branch 'main' into nolintlint-flags
GiteaBot cbdd619
Merge branch 'main' into nolintlint-flags
wxiaoguang 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 hidden or 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 hidden or 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
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.
Hmm, adding comments make it harder to read ...
I can help to rewrite the code to something like
(if you don't mind)
Then we can get rid of the "nolint" tricks
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.
Go ahead, the maintainer edit thing is checked :)
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, eliminating nolints is better. I think something ought to be done about the migration packages too. Maybe just a config in
.golangci.ymlthat disables revive for those files, but it's a pretty broad disable.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.
Those are fixable with a rename. I don't suppose that's breaking as migrations are internal and I'd be surprised if something in our code relied on package name. It's more of an issue of what name should there be.
There's also not much benefit in that and the
_rule could be suppressed globally (to coveroauth_*as well) or for migrations only.See text based rules which I think would work for this
Uh oh!
There was an error while loading. Please reload this page.
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.
Which specific revive rule is being triggered by these underscores? Maybe we can disable the rule itself.
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.
See:
But we can't fully disable it, because it also check other places like ID in modelsThere are too many unclear parts.
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'm not sure what the ID topic is about, but then let's go with the
skip-package-name-checksoption?Uh oh!
There was an error while loading. Please reload this page.
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.
Agree
Uh oh!
There was an error while loading. Please reload this page.
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.
Done. Added comments in 80b05b7 to document why those 3 rules are in place.
I'll probably follow this PR up with a comment enforcement - I think the reason for disabling the rule will be very useful long term.
follow up is ready - no clue how to stack stuff here so I'll wait for this to land.
Uh oh!
There was an error while loading. Please reload this page.
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.
You could go onto this branch and
git cherry-pick <hash>the commit hash(es) from the other branch, but let's do the merge then.