Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(bool_comparison): has attr cases

Co-authored-by: x10an14 <x10an14@users.noreply.github.com>

+25 -1
+4
bin/tests/data/bool_comparison.nix
··· 20 20 (false == true) 21 21 (true == false) 22 22 (true == true) 23 + 24 + # has attr 25 + (false == m ? n) 26 + (true == o ? p) 23 27 ]
+7 -1
bin/tests/snapshots/main__bool_comparison_fix.snap
··· 4 4 --- 5 5 --- tests/data/bool_comparison.nix 6 6 +++ tests/data/bool_comparison.nix [fixed] 7 - @@ -1,23 +1,23 @@ 7 + @@ -1,27 +1,27 @@ 8 8 [ 9 9 # trivial 10 10 - (a == true) ··· 39 39 + (!true) 40 40 + false 41 41 + true 42 + 43 + # has attr 44 + - (false == m ? n) 45 + - (true == o ? p) 46 + + (!m ? n) 47 + + (o ? p) 42 48 ]
+14
bin/tests/snapshots/main__bool_comparison_lint.snap
··· 86 86 · ──────┬───── 87 87 · ╰─────── Comparing true with boolean literal true 88 88 ────╯ 89 + [W01] Warning: Unnecessary comparison with boolean 90 + ╭─[data/bool_comparison.nix:25:4] 91 + 92 + 25 │ (false == m ? n) 93 + · ───────┬────── 94 + · ╰──────── Comparing m ? n with boolean literal false 95 + ────╯ 96 + [W01] Warning: Unnecessary comparison with boolean 97 + ╭─[data/bool_comparison.nix:26:4] 98 + 99 + 26 │ (true == o ? p) 100 + · ──────┬────── 101 + · ╰──────── Comparing o ? p with boolean literal true 102 + ────╯