oppiliappan / statix

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

Test errors on 0.3.3 #11

Closed SuperSandro2000 closed 2 years ago

SuperSandro2000 commented 2 years ago

When trying to update the nix package I got the following test errors:

unpacking sources
unpacking source archive /nix/store/xwgcalabp8v5bfqgpx0ncj5ydn6gqndr-source
source root is source
Executing cargoSetupPostUnpackHook
unpacking source archive /nix/store/s6jvpcpwnbbbs2kvqsxwrh5gi4hxmnzi-statix-0.3.3-vendor.tar.gz
Finished cargoSetupPostUnpackHook
patching sources
Executing cargoSetupPostPatchHook
Validating consistency between /build/source//Cargo.lock and /build/statix-0.3.3-vendor.tar.gz/Cargo.lock
Finished cargoSetupPostPatchHook
configuring
building
Executing cargoBuildHook
++ env CC_x86_64-unknown-linux-gnu=/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/c++ CC_x86_64-unknown-linux-gnu=/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3.0/bin/c++ cargo build -j 40 --target x86_64-unknown-linux-gnu --frozen --release --features json
   Compiling proc-macro2 v1.0.29
   Compiling autocfg v1.0.1
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.76
   Compiling version_check v0.9.3
   Compiling memchr v2.4.1
   Compiling serde_derive v1.0.130
   Compiling serde v1.0.130
   Compiling ryu v1.0.5
   Compiling libc v0.2.103
   Compiling log v0.4.14
   Compiling countme v2.0.4
   Compiling text-size v1.1.0
   Compiling rustc-hash v1.1.0
   Compiling hashbrown v0.9.1
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.68
   Compiling unicode-segmentation v1.8.0
   Compiling unicode-width v0.1.9
   Compiling regex-syntax v0.6.25
   Compiling smol_str v0.1.18
   Compiling cfg-if v1.0.0
   Compiling itoa v0.4.8
   Compiling lazy_static v1.4.0
   Compiling vec_map v0.8.2
   Compiling yansi v0.5.0
   Compiling fnv v1.0.7
   Compiling bitflags v1.3.2
   Compiling strsim v0.10.0
   Compiling os_str_bytes v3.1.0
   Compiling termcolor v1.1.2
   Compiling if_chain v1.0.2
   Compiling similar v2.1.0
   Compiling textwrap v0.14.2
   Compiling ariadne v0.1.3
   Compiling heck v0.3.3
   Compiling memoffset v0.6.4
   Compiling num-traits v0.2.14
   Compiling indexmap v1.7.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling vfs v0.0.0 (/build/source/vfs)
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.17
   Compiling quote v1.0.9
   Compiling atty v0.2.14
   Compiling regex v1.5.4
   Compiling rowan v0.12.6
   Compiling globset v0.4.8
   Compiling cbitset v0.2.0
   Compiling rnix v0.9.0
   Compiling clap_derive v3.0.0-beta.4
   Compiling thiserror-impl v1.0.30
   Compiling macros v0.0.0 (/build/source/macros)
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.4
   Compiling lib v0.0.0 (/build/source/lib)
   Compiling statix v0.3.3 (/build/source/bin)
    Finished release [optimized] target(s) in 47.40s
Executing cargoInstallPostBuildHook
Finished cargoInstallPostBuildHook
Finished cargoBuildHook
running tests
Executing cargoCheckHook
++ cargo test -j 40 --release --target x86_64-unknown-linux-gnu --frozen -- --test-threads=40
   Compiling vfs v0.0.0 (/build/source/vfs)
   Compiling macros v0.0.0 (/build/source/macros)
   Compiling lib v0.0.0 (/build/source/lib)
   Compiling statix v0.3.3 (/build/source/bin)
    Finished release [optimized] target(s) in 3.20s
     Running unittests (target/x86_64-unknown-linux-gnu/release/deps/lib-d9c6fa4d9e8807b3)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests (target/release/deps/macros-c56c0ac989bf21a2)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests (target/x86_64-unknown-linux-gnu/release/deps/statix-2d177cb9944f250e)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests (target/x86_64-unknown-linux-gnu/release/deps/vfs-f74186b910057318)

running 1 test
test test::trivial ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests lib

running 22 tests
test src/lints/redundant_pattern_bind.rs - lints::redundant_pattern_bind::RedundantPatternBind (line 20) ... FAILED
test src/lints/bool_comparison.rs - lints::bool_comparison::BoolComparison (line 26) ... FAILED
test src/lints/legacy_let_syntax.rs - lints::legacy_let_syntax::ManualInherit (line 20) ... FAILED
test src/lints/useless_parens.rs - lints::useless_parens::UselessParens (line 18) ... FAILED
test src/lints/eta_reduction.rs - lints::eta_reduction::EtaReduction (line 20) ... FAILED
test src/lints/eta_reduction.rs - lints::eta_reduction::EtaReduction (line 30) ... FAILED
test src/lints/bool_comparison.rs - lints::bool_comparison::BoolComparison (line 20) ... FAILED
test src/lints/collapsible_let_in.rs - lints::collapsible_let_in::CollapsibleLetIn (line 20) ... FAILED
test src/lints/empty_pattern.rs - lints::empty_pattern::EmptyPattern (line 21) ... FAILED
test src/lints/unquoted_splice.rs - lints::unquoted_splice::UnquotedSplice (line 28) ... FAILED
test src/lints/useless_parens.rs - lints::useless_parens::UselessParens (line 28) ... FAILED
test src/lints/empty_pattern.rs - lints::empty_pattern::EmptyPattern (line 31) ... FAILED
test src/lints/manual_inherit.rs - lints::manual_inherit::ManualInherit (line 19) ... FAILED
test src/lints/unquoted_splice.rs - lints::unquoted_splice::UnquotedSplice (line 19) ... FAILED
test src/lints/empty_let_in.rs - lints::empty_let_in::EmptyLetIn (line 19) ... FAILED
test src/lints/manual_inherit_from.rs - lints::manual_inherit_from::ManualInherit (line 28) ... FAILED
test src/lints/manual_inherit.rs - lints::manual_inherit::ManualInherit (line 28) ... FAILED
test src/lints/empty_let_in.rs - lints::empty_let_in::EmptyLetIn (line 25) ... FAILED
test src/lints/collapsible_let_in.rs - lints::collapsible_let_in::CollapsibleLetIn (line 32) ... FAILED
test src/lints/legacy_let_syntax.rs - lints::legacy_let_syntax::ManualInherit (line 31) ... FAILED
test src/lints/redundant_pattern_bind.rs - lints::redundant_pattern_bind::RedundantPatternBind (line 26) ... FAILED
test src/lints/manual_inherit_from.rs - lints::manual_inherit_from::ManualInherit (line 19) ... FAILED

failures:

---- src/lints/redundant_pattern_bind.rs - lints::redundant_pattern_bind::RedundantPatternBind (line 20) stdout ----
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `@`
 --> src/lints/redundant_pattern_bind.rs:21:8
  |
3 | inputs @ { ... }: inputs.nixpkgs
  |        ^ expected one of 8 possible tokens

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/bool_comparison.rs - lints::bool_comparison::BoolComparison (line 26) stdout ----
error: expected `{`, found `then`
 --> src/lints/bool_comparison.rs:27:6
  |
3 | if x then 0 else 1
  | --   ^^^^
  | |    |
  | |    expected `{`
  | |    help: try placing this code inside a block: `{ then }`
  | this `if` expression has a condition, but no block

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/legacy_let_syntax.rs - lints::legacy_let_syntax::ManualInherit (line 20) stdout ----
error: expected pattern, found `{`
 --> src/lints/legacy_let_syntax.rs:21:5
  |
3 | let {
  |     ^ expected pattern

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/useless_parens.rs - lints::useless_parens::UselessParens (line 18) stdout ----
error: expected type, found `2`
 --> src/lints/useless_parens.rs:20:16
  |
4 |   double = (x: 2 * x);
  |              - ^ expected type
  |              |
  |              tried to parse a type due to this

error: expected one of `.`, `?`, `]`, or an operator, found `2`
 --> src/lints/useless_parens.rs:21:25
  |
5 |   ls = map (double) [ 1 2 3 ];
  |                         ^ expected one of `.`, `?`, `]`, or an operator

error: aborting due to 2 previous errors

Couldn't compile the test.
---- src/lints/eta_reduction.rs - lints::eta_reduction::EtaReduction (line 20) stdout ----
error: expected type, found `2`
 --> src/lints/eta_reduction.rs:22:15
  |
4 |   double = i: 2 * i;
  |             - ^ expected type
  |             |
  |             tried to parse a type due to this

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/eta_reduction.rs - lints::eta_reduction::EtaReduction (line 30) stdout ----
error: expected type, found `2`
 --> src/lints/eta_reduction.rs:32:15
  |
4 |   double = i: 2 * i;
  |             - ^ expected type
  |             |
  |             tried to parse a type due to this

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/bool_comparison.rs - lints::bool_comparison::BoolComparison (line 20) stdout ----
error: expected `{`, found `then`
 --> src/lints/bool_comparison.rs:21:14
  |
3 | if x == true then 0 else 1
  | --           ^^^^
  | |            |
  | |            expected `{`
  | |            help: try placing this code inside a block: `{ then }`
  | this `if` expression has a condition, but no block

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/collapsible_let_in.rs - lints::collapsible_let_in::CollapsibleLetIn (line 20) stdout ----
error: expected expression, found keyword `in`
 --> src/lints/collapsible_let_in.rs:23:1
  |
5 | in
  | ^^ expected expression

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/empty_pattern.rs - lints::empty_pattern::EmptyPattern (line 21) stdout ----
error: unexpected token: `...`
 --> src/lints/empty_pattern.rs:22:12
  |
3 | client = { ... }: {
  |            ^^^
  |
help: use `..` for an exclusive range
  |
3 | client = { .. }: {
  |            ^^
help: or `..=` for an inclusive range
  |
3 | client = { ..= }: {
  |            ^^^

error[E0586]: inclusive range with no end
 --> src/lints/empty_pattern.rs:22:12
  |
3 | client = { ... }: {
  |            ^^^ help: use `..` instead
  |
  = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)

error: expected type, found `{`
 --> src/lints/empty_pattern.rs:22:19
  |
3 | client = { ... }: {
  |                 - ^ expected type
  |                 |
  |                 tried to parse a type due to this

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0586`.
Couldn't compile the test.
---- src/lints/unquoted_splice.rs - lints::unquoted_splice::UnquotedSplice (line 28) stdout ----
error: unexpected token: `"${system}"`
 --> src/lints/unquoted_splice.rs:30:33
  |
4 |   pkgs = nixpkgs.legacyPackages."${system}";
  |                                 ^^^^^^^^^^^

error: expected one of `.`, `;`, `?`, or an operator, found `"${system}"`
 --> src/lints/unquoted_splice.rs:30:33
  |
4 |   pkgs = nixpkgs.legacyPackages."${system}";
  |                                 ^^^^^^^^^^^ expected one of `.`, `;`, `?`, or an operator

error: aborting due to 2 previous errors

Couldn't compile the test.
---- src/lints/useless_parens.rs - lints::useless_parens::UselessParens (line 28) stdout ----
error: expected type, found `2`
 --> src/lints/useless_parens.rs:30:15
  |
4 |   double = x: 2 * x;
  |             - ^ expected type
  |             |
  |             tried to parse a type due to this

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/empty_pattern.rs - lints::empty_pattern::EmptyPattern (line 31) stdout ----
error: expected type, found `{`
 --> src/lints/empty_pattern.rs:32:13
  |
3 | client = _: {
  |           - ^ expected type
  |           |
  |           tried to parse a type due to this

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/manual_inherit.rs - lints::manual_inherit::ManualInherit (line 19) stdout ----
error: expected expression, found keyword `in`
 --> src/lints/manual_inherit.rs:22:1
  |
5 | in
  | ^^ expected expression

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/unquoted_splice.rs - lints::unquoted_splice::UnquotedSplice (line 19) stdout ----
error: unexpected token: `$`
 --> src/lints/unquoted_splice.rs:21:33
  |
4 |   pkgs = nixpkgs.legacyPackages.${system};
  |                                 ^

error: expected one of `.`, `;`, `?`, or an operator, found `$`
 --> src/lints/unquoted_splice.rs:21:33
  |
4 |   pkgs = nixpkgs.legacyPackages.${system};
  |                                 ^ expected one of `.`, `;`, `?`, or an operator

error: aborting due to 2 previous errors

Couldn't compile the test.
---- src/lints/empty_let_in.rs - lints::empty_let_in::EmptyLetIn (line 19) stdout ----
error: expected pattern, found keyword `in`
 --> src/lints/empty_let_in.rs:20:5
  |
3 | let in pkgs.statix
  |     ^^ expected pattern

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/manual_inherit_from.rs - lints::manual_inherit_from::ManualInherit (line 28) stdout ----
error: expected one of `)`, `,`, `@`, or `|`, found `.`
 --> src/lints/manual_inherit_from.rs:30:16
  |
4 |   inherit (pkgs.haskellPackages) mtl;
  |                ^
  |                |
  |                expected one of `)`, `,`, `@`, or `|`
  |                help: missing `,`

error: expected one of `:`, `;`, `=`, or `|`, found `mtl`
 --> src/lints/manual_inherit_from.rs:30:34
  |
4 |   inherit (pkgs.haskellPackages) mtl;
  |                                  ^^^ expected one of `:`, `;`, `=`, or `|`

error: aborting due to 2 previous errors

Couldn't compile the test.
---- src/lints/manual_inherit.rs - lints::manual_inherit::ManualInherit (line 28) stdout ----
error: expected expression, found keyword `in`
 --> src/lints/manual_inherit.rs:31:1
  |
5 | in
  | ^^ expected expression

error: aborting due to previous error

Couldn't compile the test.
---- src/lints/empty_let_in.rs - lints::empty_let_in::EmptyLetIn (line 25) stdout ----
error[E0425]: cannot find value `pkgs` in this scope
 --> src/lints/empty_let_in.rs:26:1
  |
3 | pkgs.statix
  | ^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
Couldn't compile the test.
---- src/lints/collapsible_let_in.rs - lints::collapsible_let_in::CollapsibleLetIn (line 32) stdout ----
error: expected expression, found keyword `in`
 --> src/lints/collapsible_let_in.rs:36:1
  |
6 | in
  | ^^ expected expression

error[E0425]: cannot find value `b` in this scope
 --> src/lints/collapsible_let_in.rs:35:3
  |
5 |   b = 3;
  |   ^ help: a local variable with a similar name exists: `a`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
Couldn't compile the test.
---- src/lints/legacy_let_syntax.rs - lints::legacy_let_syntax::ManualInherit (line 31) stdout ----
error: expected `:`, found `=`
 --> src/lints/legacy_let_syntax.rs:33:8
  |
4 |   body = x + y;
  |       -^
  |       |
  |       help: replace equals symbol with a colon: `:`

error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, `}`, or an operator, found `;`
 --> src/lints/legacy_let_syntax.rs:33:15
  |
3 | rec {
  | --- while parsing this struct
4 |   body = x + y;
  |               ^ expected one of 8 possible tokens

error[E0422]: cannot find struct, variant or union type `rec` in this scope
   --> src/lints/legacy_let_syntax.rs:32:1
    |
3   |   rec {
    |   ^^^ help: a struct with a similar name exists: `Vec`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0422`.
Couldn't compile the test.
---- src/lints/redundant_pattern_bind.rs - lints::redundant_pattern_bind::RedundantPatternBind (line 26) stdout ----
error: casts cannot be followed by a field access
 --> src/lints/redundant_pattern_bind.rs:27:1
  |
3 | inputs: inputs.nixpkgs
  | ^^^^^^^^^^^^^^
  |
help: try surrounding the expression in parentheses
  |
3 | (inputs: inputs).nixpkgs
  | ^              ^

error[E0425]: cannot find value `inputs` in this scope
 --> src/lints/redundant_pattern_bind.rs:27:1
  |
3 | inputs: inputs.nixpkgs
  | ^^^^^^ expecting a type here because of type ascription

error[E0412]: cannot find type `inputs` in this scope
 --> src/lints/redundant_pattern_bind.rs:27:9
  |
3 | inputs: inputs.nixpkgs
  |         ^^^^^^ expecting a type here because of type ascription

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
Couldn't compile the test.
---- src/lints/manual_inherit_from.rs - lints::manual_inherit_from::ManualInherit (line 19) stdout ----
error: expected expression, found keyword `in`
 --> src/lints/manual_inherit_from.rs:22:1
  |
5 | in
  | ^^ expected expression

error[E0425]: cannot find value `pkgs` in this scope
 --> src/lints/manual_inherit_from.rs:21:9
  |
4 |   mtl = pkgs.haskellPackages.mtl;
  |         ^^^^ not found in this scope

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
Couldn't compile the test.

failures:
    src/lints/bool_comparison.rs - lints::bool_comparison::BoolComparison (line 20)
    src/lints/bool_comparison.rs - lints::bool_comparison::BoolComparison (line 26)
    src/lints/collapsible_let_in.rs - lints::collapsible_let_in::CollapsibleLetIn (line 20)
    src/lints/collapsible_let_in.rs - lints::collapsible_let_in::CollapsibleLetIn (line 32)
    src/lints/empty_let_in.rs - lints::empty_let_in::EmptyLetIn (line 19)
    src/lints/empty_let_in.rs - lints::empty_let_in::EmptyLetIn (line 25)
    src/lints/empty_pattern.rs - lints::empty_pattern::EmptyPattern (line 21)
    src/lints/empty_pattern.rs - lints::empty_pattern::EmptyPattern (line 31)
    src/lints/eta_reduction.rs - lints::eta_reduction::EtaReduction (line 20)
    src/lints/eta_reduction.rs - lints::eta_reduction::EtaReduction (line 30)
    src/lints/legacy_let_syntax.rs - lints::legacy_let_syntax::ManualInherit (line 20)
    src/lints/legacy_let_syntax.rs - lints::legacy_let_syntax::ManualInherit (line 31)
    src/lints/manual_inherit.rs - lints::manual_inherit::ManualInherit (line 19)
    src/lints/manual_inherit.rs - lints::manual_inherit::ManualInherit (line 28)
    src/lints/manual_inherit_from.rs - lints::manual_inherit_from::ManualInherit (line 19)
    src/lints/manual_inherit_from.rs - lints::manual_inherit_from::ManualInherit (line 28)
    src/lints/redundant_pattern_bind.rs - lints::redundant_pattern_bind::RedundantPatternBind (line 20)
    src/lints/redundant_pattern_bind.rs - lints::redundant_pattern_bind::RedundantPatternBind (line 26)
    src/lints/unquoted_splice.rs - lints::unquoted_splice::UnquotedSplice (line 19)
    src/lints/unquoted_splice.rs - lints::unquoted_splice::UnquotedSplice (line 28)
    src/lints/useless_parens.rs - lints::useless_parens::UselessParens (line 18)
    src/lints/useless_parens.rs - lints::useless_parens::UselessParens (line 28)

test result: FAILED. 0 passed; 22 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s

error: test failed, to rerun pass '--doc'

Maybe configuring some github actions that runs the tests could discover such problems earlier in the future.

oppiliappan commented 2 years ago

Good catch, I missed this because the statix flake disables rust tests (I'll open a PR to do the same on nixpkgs). As of now, statix does not have any useful tests.