-
Notifications
You must be signed in to change notification settings - Fork 38
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
Comments
I would like this to work around astral-sh/ruff#8232 by running |
Something like this should work: [formatter.ruff]
command = "sh"
options = ["-c", "ruff check \"$@\" && ruff format \"$@\"", "--"]
includes = ["*.py", "*.pyi"] |
First: thanks for this time-saving project! What's the maintainers' opinion about linters in The docs seem to speak about formatters only, not linters. Also, the name "treefmt" suggests that this is a project about code formatting. Currently, Just asking to see what the chances would be for PRs to support more linters like 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 |
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 <[email protected]> Co-committed-by: zimbatm <[email protected]>
Stacked on top of #11 Co-authored-by: Brian McGee <[email protected]> Reviewed-on: https://git.numtide.com/numtide/treefmt/pulls/13 Co-authored-by: zimbatm <[email protected]> Co-committed-by: zimbatm <[email protected]>
This would be very helpful. I recently changed my treefmt-nix config to use treefmt v2 instead of v1 in order to avoid #153, but now I find that v2 errors with “path '…' matched multiple formatters/pipelines [hlint ormolu]” on all my Haskell code. I’m currently waffling on whether I should go back to v1 for Haskell projects (which skips formatting many things) or disable hlint. |
Ah, whoops – it’s 2.0.0-rc2, from Nixpkgs 24.05 (the current release). I usually check these things, but assumed this issue was specifically about the problem of having multiple formatters. Thanks – I’ll overlay a newer one. |
@sellout multiple formatters on the same files are not a problem anymore: https://treefmt.com/configure#same-file-multiple-formatters |
Thanks – I pulled 2.0.5 from nixpkgs-unstable and the formatting is working better than ever. No notes. |
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.
The text was updated successfully, but these errors were encountered: