refactor(natu): rename xatu #97

Merged
alexion merged 0 commits from refs/pull/97/head into main 2026-09-26 20:13:21 -04:00
26 changed files with 82 additions and 81 deletions
Showing only changes of commit 0c1a1c1ffa - Show all commits

No files matched your search

+1 -1
View File
@@ -105,7 +105,7 @@
Do not use `nix fmt` as a validation command until a formatter is added. Do not use `nix fmt` as a validation command until a formatter is added.
- The `fix` app passes its current directory to Deadnix. - The `fix` app passes its current directory to Deadnix.
Run `nix run .#fix` from the repository root so path exclusions match. Run `nix run .#fix` from the repository root so path exclusions match.
- During the Nix refactor, address each issue that comes up by adding either a Xatu rule or a new Nix style rule. - During the Nix refactor, address each issue that comes up by adding either a Natu rule or a new Nix style rule.
- Git pathspec searches started in a subdirectory default to that subtree. - Git pathspec searches started in a subdirectory default to that subtree.
Use `git -C <repository-root>` or top-anchored pathspecs for repository-wide history searches. Use `git -C <repository-root>` or top-anchored pathspecs for repository-wide history searches.
- Ariadne extraction must preserve the game-root season prefix for archived source. - Ariadne extraction must preserve the game-root season prefix for archived source.
Generated
+12 -12
View File
@@ -190,6 +190,18 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
name = "monorepo" name = "monorepo"
version = "0.1.0" version = "0.1.0"
[[package]]
name = "natu"
version = "0.1.0"
dependencies = [
"clap",
"googletest",
"monorepo",
"rnix",
"rowan",
"status",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.19" version = "0.2.19"
@@ -393,18 +405,6 @@ dependencies = [
"windows-link", "windows-link",
] ]
[[package]]
name = "xatu"
version = "0.1.0"
dependencies = [
"clap",
"googletest",
"monorepo",
"rnix",
"rowan",
"status",
]
[[package]] [[package]]
name = "zmij" name = "zmij"
version = "1.0.23" version = "1.0.23"
+1 -1
View File
@@ -4,7 +4,7 @@ members = [
"src/machoke", "src/machoke",
"src/monorepo", "src/monorepo",
"src/status", "src/status",
"src/xatu", "src/natu",
] ]
resolver = "3" resolver = "3"
+1
View File
@@ -14,4 +14,5 @@ rust = use_extension("//bazel:rust.bzl", "rust")
use_repo(rust, "rust") use_repo(rust, "rust")
register_toolchains("@python//:python") register_toolchains("@python//:python")
register_toolchains("@rust//:rust") register_toolchains("@rust//:rust")
+2 -2
View File
@@ -3,7 +3,7 @@
- machoke - machoke
- falinks - falinks
- dotfiles - dotfiles
- xatu - natu
- nix-style / refactor - nix-style / refactor
# project ideas # project ideas
@@ -100,7 +100,7 @@
- https://www.youtube.com/watch?v=kzcI5F4tGiU - https://www.youtube.com/watch?v=kzcI5F4tGiU
- https://www.youtube.com/watch?v=iKwPaB5TUdI - https://www.youtube.com/watch?v=iKwPaB5TUdI
- https://www.youtube.com/watch?v=A-CtdQFRX64 - https://www.youtube.com/watch?v=A-CtdQFRX64
- xatu literature - natu literature
- https://rust-analyzer.github.io/book/contributing/syntax.html?utm_source=chatgpt.com - https://rust-analyzer.github.io/book/contributing/syntax.html?utm_source=chatgpt.com
- https://github.com/dotnet/roslyn/blob/main/docs/compilers/Design/Red-Green%20Trees.md?utm_source=chatgpt.com - https://github.com/dotnet/roslyn/blob/main/docs/compilers/Design/Red-Green%20Trees.md?utm_source=chatgpt.com
- https://github.com/rust-analyzer/rowan/blob/master/examples/s_expressions.rs?utm_source=chatgpt.com - https://github.com/rust-analyzer/rowan/blob/master/examples/s_expressions.rs?utm_source=chatgpt.com
+1 -1
View File
@@ -24,7 +24,7 @@ in
configs/nixos/hosts/neogaia/hardware-configuration.nix \ configs/nixos/hosts/neogaia/hardware-configuration.nix \
configs/nixos/hosts/pikachu/hardware-configuration.nix \ configs/nixos/hosts/pikachu/hardware-configuration.nix \
configs/nixos/hosts/zeus/hardware-configuration.nix \ configs/nixos/hosts/zeus/hardware-configuration.nix \
src/xatu/testdata \ src/natu/testdata \
third_party \ third_party \
-- . -- .
treefmt treefmt
+1 -1
View File
@@ -6,7 +6,7 @@ inputs.treefmt-nix.lib.evalModule inputs.nixpkgs.legacyPackages.${system} {
settings.formatter.nixfmt.excludes = [ settings.formatter.nixfmt.excludes = [
"configs/nixos/hosts/*/hardware-configuration.nix" "configs/nixos/hosts/*/hardware-configuration.nix"
"src/xatu/testdata/*.nix" "src/natu/testdata/*.nix"
"third_party/**" "third_party/**"
]; ];
} }
+11 -11
View File
@@ -1,11 +1,12 @@
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test") load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
rust_library( rust_library(
name = "xatu_lib", name = "natu_lib",
crate_name = "xatu", crate_name = "natu",
srcs = [ srcs = [
"ast.rs", "ast.rs",
"file_store.rs", "file_store.rs",
"natu.rs",
"parser.rs", "parser.rs",
"rules.rs", "rules.rs",
"rules/let_order.rs", "rules/let_order.rs",
@@ -13,7 +14,6 @@ rust_library(
"rules/manual_inherit_from.rs", "rules/manual_inherit_from.rs",
"rules/unquoted_uri.rs", "rules/unquoted_uri.rs",
"scope_graph.rs", "scope_graph.rs",
"xatu.rs",
], ],
deps = [ deps = [
"//src/status:status", "//src/status:status",
@@ -25,30 +25,30 @@ rust_library(
rust_test( rust_test(
name = "file_store_test", name = "file_store_test",
srcs = ["file_store_test.rs"], srcs = ["file_store_test.rs"],
deps = [":xatu_lib"], deps = [":natu_lib"],
) )
rust_test( rust_test(
name = "xatu_test", name = "natu_test",
srcs = ["xatu_test.rs"], srcs = ["natu_test.rs"],
data = [ data = [
"testdata/clean.nix", "testdata/clean.nix",
"testdata/invalid.nix", "testdata/invalid.nix",
"testdata/lint_findings.nix", "testdata/lint_findings.nix",
], ],
deps = [ deps = [
":xatu_lib", ":natu_lib",
"//src/status:status", "//src/status:status",
"//third_party/crates:googletest", "//third_party/crates:googletest",
], ],
) )
rust_binary( rust_binary(
name = "xatu", name = "natu",
crate_name = "xatu_cli", crate_name = "natu_cli",
srcs = ["xatu_main.rs"], srcs = ["natu_main.rs"],
deps = [ deps = [
":xatu_lib", ":natu_lib",
"//src/monorepo:monorepo", "//src/monorepo:monorepo",
"//src/status:status", "//src/status:status",
"//third_party/crates:clap", "//third_party/crates:clap",
+4 -4
View File
@@ -1,14 +1,14 @@
[package] [package]
name = "xatu" name = "natu"
version = "0.1.0" version = "0.1.0"
edition = "2024" edition = "2024"
[lib] [lib]
path = "xatu.rs" path = "natu.rs"
[[bin]] [[bin]]
name = "xatu" name = "natu"
path = "xatu_main.rs" path = "natu_main.rs"
[dependencies] [dependencies]
clap = { workspace = true, features = ["derive"] } clap = { workspace = true, features = ["derive"] }
View File
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
use std::path::PathBuf; use std::path::PathBuf;
use xatu::{FileStore, SourceFile}; use natu::{FileStore, SourceFile};
fn source_file(path: &str, source: &str) -> SourceFile { fn source_file(path: &str, source: &str) -> SourceFile {
SourceFile { SourceFile {
+1 -1
View File
@@ -53,7 +53,7 @@ fn line_range(source: &str, range: ast::SourceRange) -> (usize, usize) {
(start, end) (start, end)
} }
/// Analyzes source files and returns the diagnostics Xatu finds. /// Analyzes source files and returns the diagnostics Natu finds.
pub fn future_sight(files: Vec<SourceFile>) -> status::Result<Report> { pub fn future_sight(files: Vec<SourceFile>) -> status::Result<Report> {
let mut store = FileStore::default(); let mut store = FileStore::default();
let mut diagnostics = Vec::new(); let mut diagnostics = Vec::new();
@@ -1,8 +1,8 @@
use clap::Parser; use clap::Parser;
use natu::{Report, SourceFile};
use status::ResultExt; use status::ResultExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::ExitCode; use std::process::ExitCode;
use xatu::{Report, SourceFile};
fn main() -> ExitCode { fn main() -> ExitCode {
let args = Args::parse(); let args = Args::parse();
@@ -44,7 +44,7 @@ fn analyze(args: Args) -> status::Result<Report> {
.flatten() .flatten()
.collect(); .collect();
xatu::future_sight(files) natu::future_sight(files)
} }
fn collect_source_files(path: &Path) -> status::Result<Vec<SourceFile>> { fn collect_source_files(path: &Path) -> status::Result<Vec<SourceFile>> {
+14 -14
View File
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use googletest::matchers::{contains, eq, is_true}; use googletest::matchers::{contains, eq, is_true};
use googletest::{OrFail, expect_that, gtest}; use googletest::{OrFail, expect_that, gtest};
use status::Code; use status::Code;
use xatu::SourceFile; use natu::SourceFile;
fn fixture_source(path: &str) -> googletest::Result<SourceFile> { fn fixture_source(path: &str) -> googletest::Result<SourceFile> {
Ok(SourceFile { Ok(SourceFile {
@@ -20,20 +20,20 @@ fn fixture_path(path: &str) -> googletest::Result<PathBuf> {
let runfiles = PathBuf::from(std::env::var("TEST_SRCDIR").or_fail()?); let runfiles = PathBuf::from(std::env::var("TEST_SRCDIR").or_fail()?);
let workspace = std::env::var("TEST_WORKSPACE").or_fail()?; let workspace = std::env::var("TEST_WORKSPACE").or_fail()?;
Ok(runfiles.join(workspace).join("src/xatu").join(path)) Ok(runfiles.join(workspace).join("src/natu").join(path))
} }
#[gtest] #[gtest]
fn xatu_accepts_clean_source() -> googletest::Result<()> { fn natu_accepts_clean_source() -> googletest::Result<()> {
let report = xatu::future_sight(vec![fixture_source("testdata/clean.nix")?]).or_fail()?; let report = natu::future_sight(vec![fixture_source("testdata/clean.nix")?]).or_fail()?;
expect_that!(report.is_clean(), is_true()); expect_that!(report.is_clean(), is_true());
Ok(()) Ok(())
} }
#[gtest] #[gtest]
fn xatu_rejects_invalid_source() -> googletest::Result<()> { fn natu_rejects_invalid_source() -> googletest::Result<()> {
let error = xatu::future_sight(vec![fixture_source("testdata/invalid.nix")?]) let error = natu::future_sight(vec![fixture_source("testdata/invalid.nix")?])
.err() .err()
.or_fail()?; .or_fail()?;
@@ -42,8 +42,8 @@ fn xatu_rejects_invalid_source() -> googletest::Result<()> {
} }
#[gtest] #[gtest]
fn xatu_reports_out_of_order_let_bindings() -> googletest::Result<()> { fn natu_reports_out_of_order_let_bindings() -> googletest::Result<()> {
let report = xatu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?; let report = natu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?;
let let_order_count = report let let_order_count = report
.diagnostics .diagnostics
@@ -55,8 +55,8 @@ fn xatu_reports_out_of_order_let_bindings() -> googletest::Result<()> {
} }
#[gtest] #[gtest]
fn xatu_reports_unquoted_uri() -> googletest::Result<()> { fn natu_reports_unquoted_uri() -> googletest::Result<()> {
let report = xatu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?; let report = natu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?;
let findings = report let findings = report
.diagnostics .diagnostics
@@ -79,8 +79,8 @@ fn xatu_reports_unquoted_uri() -> googletest::Result<()> {
} }
#[gtest] #[gtest]
fn xatu_reports_manual_inherit() -> googletest::Result<()> { fn natu_reports_manual_inherit() -> googletest::Result<()> {
let report = xatu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?; let report = natu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?;
let manual_inherit_count = report let manual_inherit_count = report
.diagnostics .diagnostics
@@ -92,8 +92,8 @@ fn xatu_reports_manual_inherit() -> googletest::Result<()> {
} }
#[gtest] #[gtest]
fn xatu_reports_manual_inherit_from() -> googletest::Result<()> { fn natu_reports_manual_inherit_from() -> googletest::Result<()> {
let report = xatu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?; let report = natu::future_sight(vec![fixture_source("testdata/lint_findings.nix")?]).or_fail()?;
let manual_inherit_from_count = report let manual_inherit_from_count = report
.diagnostics .diagnostics
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+30 -30
View File
@@ -314,8 +314,8 @@ _CRATE_EDITIONS = {
"src/ariadne": "2024", "src/ariadne": "2024",
"src/machoke": "2024", "src/machoke": "2024",
"src/monorepo": "2024", "src/monorepo": "2024",
"src/natu": "2024",
"src/status": "2024", "src/status": "2024",
"src/xatu": "2024",
} }
_NORMAL_DEPENDENCIES = { _NORMAL_DEPENDENCIES = {
@@ -335,15 +335,15 @@ _NORMAL_DEPENDENCIES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
},
"src/xatu": {
_COMMON_CONDITION: { _COMMON_CONDITION: {
"clap": Label("//third_party/crates/clap-4.6.7:clap"), "clap": Label("//third_party/crates/clap-4.6.7:clap"),
"rnix": Label("//third_party/crates/rnix-0.14.0:rnix"), "rnix": Label("//third_party/crates/rnix-0.14.0:rnix"),
"rowan": Label("//third_party/crates/rowan-0.16.1:rowan"), "rowan": Label("//third_party/crates/rowan-0.16.1:rowan"),
}, },
}, },
"src/status": {
},
} }
_NORMAL_ALIASES = { _NORMAL_ALIASES = {
@@ -359,12 +359,12 @@ _NORMAL_ALIASES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
},
"src/xatu": {
_COMMON_CONDITION: { _COMMON_CONDITION: {
}, },
}, },
"src/status": {
},
} }
_NORMAL_DEV_DEPENDENCIES = { _NORMAL_DEV_DEPENDENCIES = {
@@ -376,13 +376,13 @@ _NORMAL_DEV_DEPENDENCIES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
},
"src/xatu": {
_COMMON_CONDITION: { _COMMON_CONDITION: {
"googletest": Label("//third_party/crates/googletest-0.14.3:googletest"), "googletest": Label("//third_party/crates/googletest-0.14.3:googletest"),
}, },
}, },
"src/status": {
},
} }
_NORMAL_DEV_ALIASES = { _NORMAL_DEV_ALIASES = {
@@ -394,12 +394,12 @@ _NORMAL_DEV_ALIASES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
},
"src/xatu": {
_COMMON_CONDITION: { _COMMON_CONDITION: {
}, },
}, },
"src/status": {
},
} }
_PROC_MACRO_DEPENDENCIES = { _PROC_MACRO_DEPENDENCIES = {
@@ -411,9 +411,9 @@ _PROC_MACRO_DEPENDENCIES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }
@@ -426,9 +426,9 @@ _PROC_MACRO_ALIASES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }
@@ -441,9 +441,9 @@ _PROC_MACRO_DEV_DEPENDENCIES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }
@@ -456,12 +456,12 @@ _PROC_MACRO_DEV_ALIASES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
},
"src/xatu": {
_COMMON_CONDITION: { _COMMON_CONDITION: {
}, },
}, },
"src/status": {
},
} }
_BUILD_DEPENDENCIES = { _BUILD_DEPENDENCIES = {
@@ -473,9 +473,9 @@ _BUILD_DEPENDENCIES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }
@@ -488,9 +488,9 @@ _BUILD_ALIASES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }
@@ -503,9 +503,9 @@ _BUILD_PROC_MACRO_DEPENDENCIES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }
@@ -518,9 +518,9 @@ _BUILD_PROC_MACRO_ALIASES = {
}, },
"src/monorepo": { "src/monorepo": {
}, },
"src/status": { "src/natu": {
}, },
"src/xatu": { "src/status": {
}, },
} }