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

Add staticcheck.conf to reduce unactionable noise in IDEs #34036

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

nfagerlund
Copy link
Member

Turns out go-staticcheck will respect a config file and merge configs across subtrees of packages.

Since we already specify a list of staticcheck rules to ignore in the scripts/staticcheck.sh wrapper script, this hoists those preferences up to the top of the package tree, so they also affect the staticcheck integration in editors like VSCode. This avoids unnecessary yellow-squiggles for capitalized error messages, and makes integrated linting much more useful.

The thing I'm trying to make it shut up about

image

Target Release

1.7.x

Draft CHANGELOG entry

N/A; this has no runtime effect on Terraform.

Since we already specify a list of staticcheck rules to ignore in the
scripts/staticcheck.sh wrapper script, this hoists those preferences up to the
top of the package tree, so they also affect the staticcheck integration in
editors like VSCode. This avoids unnecessary yellow-squiggles for capitalized
error messages, and makes integrated linting much more useful.
Copy link
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

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

This is cool!

I think we can remove the -checks argument from the script, so that we don't have two copies of these settings which may diverge. That seems to work locally for me, at least.

If it works in CI too, perhaps we should also add a comment to that script pointing at this config file for future people.

@nfagerlund
Copy link
Member Author

I was wondering if I could get away with that! :D I'll amend and we'll see what CI does with it

@nfagerlund
Copy link
Member Author

Nice, looks like just setting it globally works in CI too.

Copy link
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@nfagerlund nfagerlund merged commit af441ab into main Oct 12, 2023
@nfagerlund nfagerlund deleted the nf/oct23-staticccheck-chill-plz branch October 12, 2023 18:01
@github-actions
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link
Contributor

github-actions bot commented Dec 8, 2023

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants