oppiliappan / statix

lints and suggestions for the nix programming language
https://git.peppe.rs/languages/statix/about
MIT License
557 stars 21 forks source link

Provide an output that has JSON enabled #22

Closed NobbZ closed 2 years ago

NobbZ commented 2 years ago

Currently one has to override the statix package to be able to use the json feature, which again makes it impossible to use through nix run without wrapping the output in an own flake.

This also results in not beeing able to use the cachix.

It therefore would be nice to have an output that has the JSON feature enabled.

Also --format json should not appear in the help if the JSON feature is not available.

oppiliappan commented 2 years ago

The default flake output enables the json feature. Cachix should also have the same enabled. Could you confirm the same on the latest releast (0.4.2) as well? Perhaps one of the older versions did not include this.

Also --format json should not appear in the help if the JSON feature is not available.

Agreed, let me take a look at implementing this. The CLI help text is auto-generated via doc comments at the moment, so I am not sure if I can make it display different text conditionally.

NobbZ commented 2 years ago

I assume it was added through commit https://github.com/nerdypepper/statix/commit/1079486539d44b2e70c623fb4948d6e0b9b11812, which happened about a week after I created this issue, and I think this is what fixed the issue.

I just tried to be sure and I do not get any error when doing --format json.

oppiliappan commented 2 years ago

The help text is now fixed with https://github.com/nerdypepper/statix/commit/448e6f2096b855bee1464c514dfb73477fb39774 :tada: