oppiliappan / statix

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

statix stops linting when seeing an empty-ish directory #38

Closed tljuniper closed 1 year ago

tljuniper commented 2 years ago

When doing some source filtering, I came across some weird behavior. When checking a directory with statix check <dir>, statix aborts when coming across a directory that has either no files in it or only other directories:

$ tree
.
└── dir
    └── broken.nix

1 directory, 1 file

Once you create any file in ., statix will continue checking the files:

# Go into empty directory `.`
$ mkdir dir
$ echo "{}: 42" > dir/broken.nix

$ statix check .
$ touch README.md
$ statix check .
[W10] Warning: Found empty pattern in function argument
   ╭─[./dir/broken.nix:1:1]
   │
 1 │ {}: 42
   · ─┬  
   ·  ╰── This pattern is empty, use _ instead
───╯

I can't read Rust, so I've no idea what causes the issue. Can you help out?

oppiliappan commented 2 years ago

Ah, I think I see the issue, let me try to get this fixed over the weekend!