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

test and fix check blanks in var declarations #219

Merged
merged 3 commits into from
Jan 11, 2023

Conversation

gburt
Copy link
Contributor

@gburt gburt commented Jan 11, 2023

I noticed that var foo, _ = bar() blanks weren't getting checked because ast.GenDecl statements (a subset of which are var declarations) weren't being handled/visited. Fix that, and add back the analyzer tests for blank (and assert) flags.

To handle them, I refactored the existing assignment check. It's completely unchanged except it now takes LHS and RHS args that we feed it from both the GenDecl and AssignStmt nodes' values.

@gburt
Copy link
Contributor Author

gburt commented Jan 11, 2023

btw thanks for this work, we're very glad to have it helping make our code better!

@kisielk
Copy link
Owner

kisielk commented Jan 11, 2023

Thanks very much for the thorough PR. Looks good to me but it seems there are some failing tests. Could you please take a look?

@gburt
Copy link
Contributor Author

gburt commented Jan 11, 2023

doh I'd just been running go test -run TestAnalyzer/check_blanks and hadn't noticed the other test failures

@gburt
Copy link
Contributor Author

gburt commented Jan 11, 2023

now we just need to make a "you visited AssignStmt but not GenDecl" linter :)

@kisielk
Copy link
Owner

kisielk commented Jan 11, 2023

Waiting for #221 to merge before merging this.

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.

2 participants