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

Implement statix Linter and Fixer #3969

Merged
merged 8 commits into from
Nov 11, 2021
Merged

Implement statix Linter and Fixer #3969

merged 8 commits into from
Nov 11, 2021

Conversation

cyntheticfox
Copy link
Contributor

Write an implementation for statix to use as both a linter and a fixer, using statix check and statix fix respectively.

I previously made a PR for this as #3967, and closed it when I realized there were breaking changes with the v0.4.0 release. This implementation works with v0.4.0, and adds fixer support as well.

Made some minor ale-nix.txt formatting fixes as well left over from my previous implementation of nixfmt and from nixpkgs-fmt.

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Would be great if you can add a test for the linter handler with common output generated by the linter.

Add `statix check` as a linter. Provides a simple set of definition
tests additionally. Variable names specify "check" to allow for later
addition of `statix fix` as a formatter once stream support is added.

Signed-off-by: David Houston <houstdav000@gmail.com>
I didn't realise there were two separate lists of tools, so add statix
to the other list. Also, remembered "S" comes after "R", and so
re-ordered it.

Signed-off-by: David Houston <houstdav000@gmail.com>
I refactored the variables for statix to allow for writing a fixer
later, and forgot to update them in the test, so update them now. Also
remove a stray "i", add missing space before checks

Signed-off-by: David Houston <houstdav000@gmail.com>
statix v0.4.0 provides a breaking change of output stream from stderr to
stdout.

Signed-off-by: David Houston <houstdav000@gmail.com>
Implement statix fix as a fixer for simple Nix antipatterns.

Signed-off-by: David Houston <houstdav000@gmail.com>
Fix the statix fixer tests by removing the unnecessary
'read_temporary_file' value from the command, since it simply uses the
default value.

Signed-off-by: David Houston <houstdav000@gmail.com>
Add a test for the statix handler per @hsanson's request.

Signed-off-by: David Houston <houstdav000@gmail.com>
@cyntheticfox
Copy link
Contributor Author

Alright, added a handler test in 0cea76d, and ensured the tests pass locally.

Signed-off-by: David Houston <houstdav000@gmail.com>
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Great, thanks for the contribution.

@hsanson hsanson merged commit a9d7f45 into dense-analysis:master Nov 11, 2021
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.

None yet

2 participants