Skip to content

Statix runs on excludes files. #288

Open
@zmrocze

Description

@zmrocze

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions