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

[E00] Error: Syntax error #72

Closed MAHDTech closed 1 year ago

MAHDTech commented 1 year ago

Hi,

Wondering if I could get some pointers on where I'm going wrong with this issue.

export RUST_BACKTRACE=full

nix run nixpkgs#statix -- check

[bin/src/config.rs:79] [self.ignore.as_slice(), extra_ignores].concat() = []
[E00] Error: Syntax error
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /build/statix-0.5.6-vendor.tar.gz/ariadne/src/source.rs:109:25
stack backtrace:
   0:     0x5602b5e8a09c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf2ea00d5f3b53d9f
   1:     0x5602b5ebbc1e - core::fmt::write::ha076a7e65c6b1874
   2:     0x5602b5e9c1e1 - std::io::Write::write_fmt::h9630bb3b0fe886f5
   3:     0x5602b5ea40b5 - std::panicking::default_hook::{{closure}}::h64163197f96398c1
   4:     0x5602b5ea3d12 - std::panicking::default_hook::h92625161492e6b48
   5:     0x5602b5ea45d1 - std::panicking::rust_panic_with_hook::hfdd7d6bb6788c6c2
   6:     0x5602b5e8a3d7 - std::panicking::begin_panic_handler::{{closure}}::he81a60a7ef84ad4a
   7:     0x5602b5e8a1b4 - std::sys_common::backtrace::__rust_end_short_backtrace::h62801bf9780239e6
   8:     0x5602b5ea4282 - rust_begin_unwind
   9:     0x5602b5cfecc3 - core::panicking::panic_fmt::hfd221b9f37504b4a
  10:     0x5602b5cfec02 - core::panicking::panic_bounds_check::hd62ce49e2c7e15d6
  11:     0x5602b5d62a3c - ariadne::source::Source::get_offset_line::hff6557d6c6989d76
  12:     0x5602b5d06a9d - ariadne::write::<impl ariadne::Report<S>>::write::h6d21c3b3fc711aae
  13:     0x5602b5d130bd - statix::traits::write_stderr::hf326e6e9162805f2
  14:     0x5602b5d2d6e0 - statix::lint::main::main::h02d93095411c466b
  15:     0x5602b5d023b1 - statix::main::h75b6529e2c6a3a28
  16:     0x5602b5d00243 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd0a11a681f67d665
  17:     0x5602b5d00d29 - std::rt::lang_start::{{closure}}::h4151b7edf354832b
  18:     0x5602b5e956b5 - std::rt::lang_start_internal::h09bcc9fffd987f14
  19:     0x5602b5d025c2 - main
  20:     0x7fe0dc8dc24e - __libc_start_call_main
  21:     0x7fe0dc8dc309 - __libc_start_main_alias_1
  22:     0x5602b5cfef05 - _start
  23:                0x0 - <unknown>
MAHDTech commented 1 year ago

Turned out to be the simplest thing, I had imported a file that was empty, after removing the empty file and import, statix runs without error. 🚀