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

refactor (rule/flag-param): replace AST walker by iteration over declarations #1164

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

chavacava
Copy link
Collaborator

Simplifies flag-param rule by replacing AST walker by an iteration over global declarations

@@ -73,28 +63,22 @@ func (w conditionVisitor) Visit(node ast.Node) ast.Visitor {
return w
}

fselect := func(n ast.Node) bool {
findUsesOfIds := func(n ast.Node) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ids doesn't seem to respect Go initialism

What about this?

Suggested change
findUsesOfIds := func(n ast.Node) bool {
findUsesOfIDs := func(n ast.Node) bool {

Or

Suggested change
findUsesOfIds := func(n ast.Node) bool {
findIdsUsage := func(n ast.Node) bool {

Comment on lines 33 to 34
for _, paramId := range param.Names {
boolParams[paramId.Name] = struct{}{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe:

Suggested change
for _, paramId := range param.Names {
boolParams[paramId.Name] = struct{}{}
for _, paramID := range param.Names {
boolParams[paramID.Name] = struct{}{}

@chavacava chavacava merged commit fcfd6ad into master Dec 4, 2024
5 checks passed
@denisvmedia denisvmedia deleted the refactor/flag-param branch December 5, 2024 12:06
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.

3 participants