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

Statix runs on excludes files. #288

Open
zmrocze opened this issue Apr 25, 2023 · 0 comments
Open

Statix runs on excludes files. #288

zmrocze opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@zmrocze
Copy link

zmrocze commented Apr 25, 2023

Hey, I exclude a generated .nix file from the pre-commit checks, but nevertheless statix fails on that file.
That's my simplified flakeParts module:

{ inputs, ... }: {
  imports = [
    inputs.pre-commit-hooks.flakeModule # Adds perSystem.pre-commit options
  ];
  perSystem = { ... }:
    {
      pre-commit = {
        settings = {
          excludes = [
            "spago-packages.nix"
          ];
          hooks = {
            statix.enable = true;
          };
          # this workaround works
          # settings.statix.ignore = [ "spago-packages.nix" ];
        };
      };
    };
}

As said - statix runs and fails on file ./bla/spago-packages.nix, eventhough it's excluded.

pass_filenames

Statix has the option pass_filenames set to false. Though to my understanding ignoring excludes is not the expected behaviour for any formatter. I've checked with some other formatter with pass_filenames=false (with rustfmt), and the excludes field had an effect.

Maybe spago-packages.nix is an import of some other not-excluded file?

No, not directly and statix doesn't analize imports for its contents.

Workaround

If you have this issue check the commented workaround in the nix snippet.

@sandydoo sandydoo added the bug Something isn't working label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants