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 support for linters #11

Open
zimbatm opened this issue Jan 18, 2021 · 4 comments
Open

Add support for linters #11

zimbatm opened this issue Jan 18, 2021 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@zimbatm
Copy link
Member

zimbatm commented Jan 18, 2021

Unlike formatters, multiple linters can be executed for a single file. Linters sometimes also write back fixes to the file.

The config format has rooms for a [linters.<name>] section.

This needs to be specced-out a bit more.

@zimbatm zimbatm added the enhancement New feature or request label Jan 18, 2021
@zimbatm zimbatm added this to the Release 0.2 milestone Feb 27, 2021
@zimbatm zimbatm modified the milestones: Release 0.2, Release 0.3 Apr 10, 2021
@zimbatm zimbatm modified the milestones: Release 0.3, Release 0.4 May 7, 2021
@zimbatm
Copy link
Member Author

zimbatm commented Dec 13, 2021

@9999years
Copy link

I would like this to work around astral-sh/ruff#8232 by running ruff check --fix && ruff format.

@zimbatm
Copy link
Member Author

zimbatm commented Feb 19, 2024

Something like this should work:

[formatter.ruff]
command = "sh"
options = ["-c", "ruff check \"$@\" && ruff format \"$@\"", "--"]
includes = ["*.py", "*.pyi"]

@evolutics
Copy link

First: thanks for this time-saving project!

What's the maintainers' opinion about linters in treefmt-nix?

The docs seem to speak about formatters only, not linters. Also, the name "treefmt" suggests that this is a project about code formatting.

Currently, treefmt-nix offers some linters such as ShellCheck, jsonnet-lint, etc.

Just asking to see what the chances would be for PRs to support more linters like hadolint or Pylint.

Surely, the distinction between formatter and linter isn't always that clear. Some linters have an additional fix mode that may change things, akin to formatting. Technically, most linters in check mode return a non-zero exit status if they discover lints, whereas most formatters exit with status zero even if they changed something (Rufo being an exception unless invoked with --simple-exit).

brianmcgee pushed a commit that referenced this issue May 13, 2024
The package was created before Go introduced their own "errors"
package.

Trade the better juju errors semantic for a smaller dependency tree.

Reviewed-on: https://git.numtide.com/numtide/treefmt/pulls/11
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>
brianmcgee added a commit that referenced this issue May 13, 2024
Stacked on top of #11

Co-authored-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: https://git.numtide.com/numtide/treefmt/pulls/13
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants