diff --git a/AGENTS.md b/AGENTS.md index 5661726..aab6be4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -103,8 +103,10 @@ - In this monorepo, "dotfiles" refers to the dotfiles/NixOS configuration under `src/dotfiles/` and `configs/nixos/`. - The flake does not currently define `formatter.x86_64-linux`. Do not use `nix fmt` as a validation command until a formatter is added. -- The `fix` app passes its current directory to Statix and Deadnix. +- The `fix` app passes its current directory to Deadnix. Run `nix run .#fix` from the repository root so path exclusions match. +- Git pathspec searches started in a subdirectory default to that subtree. + Use `git -C ` or top-anchored pathspecs for repository-wide history searches. - Ariadne extraction must preserve the game-root season prefix for archived source. Different game installs can contain compiled scripts with the same internal path. - Clew owns Ren'Py extraction, preparation, and compiled-script AST export. Ariadne owns analysis over Clew-produced data. diff --git a/Cargo.lock b/Cargo.lock index bedb295..50f9989 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,7 +401,6 @@ dependencies = [ "googletest", "monorepo", "rnix", - "rowan", "status", ] diff --git a/docs/00 INBOX/ai/nix-statix-deadnix-rules.md b/docs/00 INBOX/ai/nix-statix-deadnix-rules.md index 5c07dc2..73b6004 100644 --- a/docs/00 INBOX/ai/nix-statix-deadnix-rules.md +++ b/docs/00 INBOX/ai/nix-statix-deadnix-rules.md @@ -17,7 +17,7 @@ Use the `Decision` line on each rule for `keep`, `discard`, `update`, or `need-m ### `bool_comparison` -Decision: keep +Decision: discard Source: `statix` `W01`. Status at collection time: enabled. @@ -50,7 +50,7 @@ Direct predicates make conditions easier to scan. ### `empty_let_in` -Decision: keep +Decision: discard Source: `statix` `W02`. Status at collection time: enabled. @@ -80,7 +80,7 @@ It usually remains after editing or debugging. ### `manual_inherit` -Decision: Keep +Decision: keep Source: `statix` `W03`. Status at collection time: enabled. @@ -113,7 +113,7 @@ It removes duplicated names. ### `manual_inherit_from` -Decision: +Decision: keep Source: `statix` `W04`. Status at collection time: enabled. @@ -142,7 +142,7 @@ It avoids repeated selector names. ### `legacy_let_syntax` -Decision: keep +Decision: discard Source: `statix` `W05`. Status at collection time: enabled. @@ -180,7 +180,7 @@ Documented forms are clearer to tools and readers. ### `collapsible_let_in` -Decision: keep +Decision: discard Source: `statix` `W06`. Status at collection time: enabled. @@ -220,7 +220,7 @@ A single binding group shows the local dependencies together. ### `eta_reduction` -Decision: keep +Decision: discard Source: `statix` `W07`. Status at collection time: enabled. @@ -250,7 +250,7 @@ The direct function reference exposes the operation. ### `useless_parens` -Decision: keep +Decision: discard Source: `statix` `W08`. Status at collection time: enabled. @@ -285,7 +285,7 @@ Required precedence parentheses remain valid. ### `empty_pattern` -Decision: keep +Decision: discard Source: `statix` `W10`. Status at collection time: enabled. @@ -315,7 +315,7 @@ An empty variadic pattern looks like partial destructuring. ### `redundant_pattern_bind` -Decision: keep +Decision: discard Source: `statix` `W11`. Status at collection time: enabled. @@ -375,7 +375,7 @@ They avoid ambiguity with punctuation after the URI. ### `empty_inherit` -Decision: keep +Decision: discard Source: `statix` `W14`. Status at collection time: enabled. @@ -400,7 +400,7 @@ It usually remains after a refactor. ### `deprecated_to_path` -Decision: keep +Decision: discard Source: `statix` `W17`. Status at collection time: enabled. @@ -431,7 +431,7 @@ Explicit path construction states whether the result is absolute or relative. ### `bool_simplification` -Decision: keep +Decision: discard Source: `statix` `W18`. Status at collection time: enabled. @@ -459,7 +459,7 @@ The direct operator expresses inequality without nested boolean syntax. ### `useless_has_attr` -Decision: keep +Decision: discard Source: `statix` `W19`. Status at collection time: enabled. @@ -488,7 +488,7 @@ It avoids repeating the attribute path. ### `repeated_keys` -Decision: update so that it doesn't conflict with the custom module convention. +Decision: discard Source: `statix` `W20`. Status at collection time: disabled in `statix.toml`. @@ -529,7 +529,7 @@ The local config disables this rule, so it needs an explicit decision before pro ### `empty_list_concat` -Decision: keep +Decision: discard Source: `statix` `W23`. Status at collection time: enabled. @@ -561,7 +561,7 @@ It usually remains after conditional list construction changed. ### Unused `let` bindings -Decision: keep +Decision: discard Source: `deadnix` default check. Status at collection time: active in `nix run .#fix`. @@ -595,7 +595,7 @@ They also make refactors look unfinished. ### Unused `inherit` names -Decision: keep +Decision: discard Source: `deadnix` default check. Status at collection time: active in `nix run .#fix`. @@ -628,7 +628,7 @@ An empty result also overlaps with `statix` `empty_inherit`. ### Unused lambda arguments -Decision: keep +Decision: discard Source: `deadnix` default check. Status at collection time: active in `nix run .#fix`. @@ -658,7 +658,7 @@ A named unused argument implies missing logic. ### Unused lambda pattern names -Decision: keep +Decision: discard Source: `deadnix` default check. Status at collection time: active in `nix run .#fix`. @@ -689,7 +689,7 @@ Unused names overstate the function's inputs. ### Unused lambda pattern aliases -Decision: keep +Decision: discard Source: `deadnix` default check. Status at collection time: active in `nix run .#fix`. @@ -719,7 +719,7 @@ Keeping it unused makes the function contract look wider than it is. ### Ignored underscore bindings -Decision: keep +Decision: discard Source: `deadnix` `--no-underscore` option. Status at collection time: inactive; current fixer does not pass `--no-underscore`. @@ -748,7 +748,7 @@ Skipping all underscore bindings can hide real dead code. ### Used underscore bindings -Decision: keep +Decision: discard Source: `deadnix` `--warn-used-underscore` option. Status at collection time: inactive; current fixer does not pass `--warn-used-underscore`. diff --git a/src/flake/apps.nix b/src/flake/apps.nix index 6f5212f..321cdb3 100644 --- a/src/flake/apps.nix +++ b/src/flake/apps.nix @@ -15,16 +15,10 @@ in name = "fix"; runtimeInputs = [ formatter - pkgs.statix pkgs.deadnix ]; text = '' treefmt - statix fix \ - --ignore 'configs/nixos/hosts/*/hardware-configuration.nix' \ - --ignore 'src/xatu/testdata/**' \ - --ignore third_party \ - . deadnix --edit \ --exclude \ configs/nixos/hosts/neogaia/hardware-configuration.nix \ diff --git a/src/xatu/BUILD b/src/xatu/BUILD index d88e2a7..3466168 100644 --- a/src/xatu/BUILD +++ b/src/xatu/BUILD @@ -8,16 +8,12 @@ rust_library( "file_store.rs", "parser.rs", "rules.rs", - "rules/deprecated_to_path.rs", - "rules/empty_inherit.rs", - "rules/empty_let_in.rs", "rules/unquoted_uri.rs", "xatu.rs", ], deps = [ "//src/status:status", "//third_party/crates:rnix", - "//third_party/crates/rowan-0.16.1:rowan", ], ) @@ -34,8 +30,6 @@ rust_test( "testdata/clean.nix", "testdata/invalid.nix", "testdata/lint_findings.nix", - "testdata/lint_interactions.nix", - "testdata/lint_variants.nix", ], deps = [ ":xatu_lib", diff --git a/src/xatu/Cargo.toml b/src/xatu/Cargo.toml index d12e186..ce0e581 100644 --- a/src/xatu/Cargo.toml +++ b/src/xatu/Cargo.toml @@ -14,7 +14,6 @@ path = "xatu_main.rs" clap = { workspace = true, features = ["derive"] } monorepo = { workspace = true } rnix = { workspace = true } -rowan = { workspace = true } status = { workspace = true } [dev-dependencies] diff --git a/src/xatu/ast.rs b/src/xatu/ast.rs index 1addbf4..8fb0c90 100644 --- a/src/xatu/ast.rs +++ b/src/xatu/ast.rs @@ -3,17 +3,10 @@ use crate::FileId; #[derive(Debug)] pub struct ParsedFile { pub file_id: FileId, - pub nodes: Vec, pub tokens: Vec, pub errors: Vec, } -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct Node { - pub range: SourceRange, - pub data: NodeData, -} - #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct SourceRange { pub start: usize, @@ -26,45 +19,6 @@ impl std::fmt::Display for SourceRange { } } -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum NodeData { - Apply(Apply), - LetIn(LetIn), - Inherit(Inherit), -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct Apply { - pub function: Expr, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum Expr { - Ident(Ident), - Select(Box