Adopt the Whitaker Dylint suite in the lint gate and CI - #410
Conversation
There was a problem hiding this comment.
Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Adopted the Whitaker Dylint lint suite across the project’s linting and CI workflow: Added an Refactored Also included CI/documentation wiring and mechanical test cleanups (e.g., typed BDD step helpers, config-discovery test refactors, and duplicate-structure test consolidation) to support the lint gate running broadly. WalkthroughAdd Whitaker linting and docs, introduce ChangesWhitaker, filesystem, and test refactor changes
Test suite hardening and module splits
Poem
Possibly related PRs
Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors, 2 warnings)
✅ Passed checks (16 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. Comment on file Arc,
atomic::{AtomicBool, Ordering},
},
use std::sync::{❌ New issue: Code Duplication |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. tests/cli_tests/config_discovery_scopes.rs Comment on lines +252 to +295 fn project_config_takes_precedence_over_user_config() -> Result<()> {
let _env_lock = EnvLock::acquire();
let cwd_guard = CwdGuard::acquire().context("capture current working directory")?;
let temp_project = tempdir().context("create temporary project directory")?;
let temp_appdata = tempdir().context("create temporary APPDATA directory")?;
// Create sandboxed Windows user-scope config at %APPDATA%\netsuke\config.toml
let netsuke_config_dir = temp_appdata.path().join("netsuke");
fs::create_dir_all(&netsuke_config_dir).context("create netsuke config directory")?;
fs::write(
netsuke_config_dir.join("config.toml"),
PRECEDENCE_USER_CONFIG_CONTENT,
)
.context("write user config.toml in APPDATA")?;
// Project config: overrides theme; does NOT set colour_policy.
fs::write(
temp_project.path().join(".netsuke.toml"),
PRECEDENCE_PROJECT_CONFIG_CONTENT,
)
.context("write project .netsuke.toml")?;
let _appdata_guard = EnvVarGuard::set("APPDATA", temp_appdata.path().as_os_str());
let _localappdata_guard = EnvVarGuard::remove("LOCALAPPDATA");
let _config_guard = EnvVarGuard::remove("NETSUKE_CONFIG");
let _config_path_guard = EnvVarGuard::remove("NETSUKE_CONFIG_PATH");
let _theme_guard = EnvVarGuard::remove("NETSUKE_THEME");
let _jobs_guard = EnvVarGuard::remove("NETSUKE_JOBS");
let _colour_guard = EnvVarGuard::remove("NETSUKE_COLOUR_POLICY");
std::env::set_current_dir(&temp_project).context("change to project directory")?;
let localizer = Arc::from(cli_localization::build_localizer(None));
let (cli, matches) = netsuke::cli::parse_with_localizer_from(["netsuke"], &localizer)
.context("parse CLI for precedence test")?;
let merged = netsuke::cli::merge_with_config(&cli, &matches)
.context("merge configs")?
.with_default_command();
let result = assert_project_precedence_applied(&merged);
drop(cwd_guard);
result
}❌ New issue: Code Duplication |
Summary
This branch adopts the Whitaker Dylint suite as part of the estate-wide lint rollout, following the pattern established in leynos/wireframe. The suite now runs clean over
--all-targets --all-features, is enforced bymake lint, and runs in CI on the stable matrix leg. Roughly 240 findings across four waves (build script → library → library tests → integration test crates) were fixed rather than suppressed, with two documented crate-level exclusions for deliberately ambient filesystem access.The adoption also surfaced a Whitaker defect —
no_std_fs_operationsignores in-sourceallow/expectattributes — filed as leynos/whitaker#270. Crate-granularity exclusion viadylint.tomlis therefore the only working escape hatch, which shaped the design below.Review walkthrough
no_std_fs_operationsexclusion carries its rationale (build script, the two boundary crates, and the fixture-staging integration test crates).whichresolver genuinely cannot express throughcap_stdhandles (a capability handle refuses to follow symlinks that leave its directory, which would break layouts such as/usr/bin/cc -> /etc/alternatives/cc). Its scope and reuse policy are documented in the crate docs. test_support/src/fs.rs is the analogous home for ambient test-fixture I/O, mirroring Whitaker's ownwhitaker_commonexclusion.open_manifest_workspaceopens the workspace'scap_stdhandle first and reads the manifest through it, instead of an ambientfs::read_to_string.Default for StdlibConfigwith a fallibleStdlibConfig::from_current_dir(); src/stdlib/command/config.rs switches the pipe limit tracker to saturating arithmetic so overflow trips the limit check rather than panicking.bumpy_road_functionrefactors and the resulting module split; src/ir/cycle.rs shows the largestmodule_max_linessplit (682 → 377 lines, helpers in src/ir/cycle_support.rs).Resultand tests consume them with?(assertions becomeanyhow::ensure!to satisfyclippy::panic_in_result_fn), fixture I/O routes throughtest_support::fs, and inline test modules gain//!docs.make lintruns rustdoc, Clippy, and Whitaker; CI installswhitaker-installer0.2.5 via a cachedcargo binstallon the stable leg only, while the MSRV and nightly legs run the newmake lint-clippysubset (Whitaker lints under its own pinned toolchain, so repeating it per leg duplicates identical work). Documentation updates live in docs/developers-guide.md, the vendored docs/whitaker-users-guide.md, and AGENTS.md.Validation
make check-fmt: passmake lint(rustdoc + Clippy +whitaker --all -- --all-targets --all-features, warnings denied): pass, zero Whitaker findingsmake typecheck: passmake test: pass (all targets, all features)make test-workflow-contracts: 6 passedmake markdownlint: 70 files, 0 errorsmake nixie: all Mermaid diagrams validmbake validate Makefile: validNotes
cfg_attr(dylint_lib = …, expect(…))) is non-functional in Whitaker v0.2.5 (no_std_fs_operations ignores in-source allow/expect attributes whitaker#270); thecfg(dylint_lib, values(any()))check-cfg allowlist entry is retained so attribute-based suppression can replace crate exclusions once the lint honours it.std::fswill fail the lint until deliberately added todylint.toml, making that policy decision visible in review.ambient_fscrate required a matching.github/dependabot.ymlentry (enforced bydependabot_config_tests).References