diff --git a/README.md b/README.md index 5bab0bfa..c8c6d0d2 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Linter runner built for speed, consistency, and low setup friction: - **Fast** — native execution (no Docker), parallel, diff-aware (changed files only), opt-in (undeclared tools don't run), small binary cached by mise -- **Local == CI** — one binary, one config, identical behavior +- **Local + CI aligned** — one binary, one config model, local defaults tuned + for day-to-day work and broader coverage in CI - **Sensible defaults** — `flint init` scaffolds a working setup quickly, and most repos can stick with the generated defaults - **Opinionated config** — Flint chooses canonical config filenames per linter, @@ -88,6 +89,19 @@ description = "Auto-fix lint issues" run = "flint run --fix" ``` +Execution defaults: + +| Invocation | Local (non-CI) | CI | +| -------------------- | ---------------------------- | --------------------------------------------------- | +| `flint run` | Linters triggered by changes | All active linters, still diff-aware where possible | +| `flint run --full` | All active linters | All active linters | +| `flint run ` | Run that linter explicitly | Run that linter explicitly | + +This means some failures may show up only in CI. When that happens, flint tells +you which command to run locally, usually `--full` or the linter name. That is +a reasonable default for day-to-day work: local runs stay focused on what you +changed, while CI runs linters based on changed files where possible. + ### CI setup ```yaml diff --git a/docs/alternatives.md b/docs/alternatives.md index fdaf579e..d6294d0a 100644 --- a/docs/alternatives.md +++ b/docs/alternatives.md @@ -8,7 +8,7 @@ the main [why/principles page](why.md). Ratings are relative and intentionally coarse. The sections below explain the "why" behind each row in more detail. -| Tool / approach | Speed | Setup effort | Cross-platform | Cross-language | Autofix support | Delta / diff-aware | Predictable and updatable linter versions | Local == CI | +| Tool / approach | Speed | Setup effort | Cross-platform | Cross-language | Autofix support | Delta / diff-aware | Predictable and updatable linter versions | Local + CI aligned | | ------------------------- | --------------------- | ----------------------------- | --------------- | -------------- | ---------------------- | ------------------ | ----------------------------------------- | ------------------------- | | flint | high | low | yes | yes | yes, where supported | yes | yes | yes | | pre-commit | medium | medium | yes | yes | mixed | mixed | mixed | mixed | @@ -19,7 +19,7 @@ Ratings are relative and intentionally coarse. The sections below explain the Use these sections as relative comparisons against Flint on a few recurring dimensions: speed, setup effort, cross-platform support, cross-language scope, autofix support, delta/diff awareness, predictable and updatable linter -versions, and how closely local behavior matches CI. +versions, and how closely local and CI behavior stay aligned. ## Flint @@ -41,7 +41,7 @@ linter or formatter should govern each domain. | Autofix support | yes, where supported | `flint run --fix` uses each tool's fixer when one exists and reports what still needs review. | | Delta / diff-aware | yes | Changed-file execution is the default model, with baseline expansion only when coverage changes require it. | | Predictable and updatable linter versions | yes | Linter versions are pinned by the repo, so behavior stays stable until the repo intentionally updates to a newer version, for example through Renovate updates to `mise.toml`. | -| Local == CI | yes | The same binary, config model, and pinned tools are used in both environments. | +| Local + CI aligned | yes | The same binary, config model, and pinned tools are used in both environments, with local defaults tuned for changed-file feedback and CI activating the full linter set. | ## pre-commit @@ -66,7 +66,7 @@ lives in hook wiring rather than in a single built-in policy. | Autofix support | mixed | Some hooks fix in place, some only report, and behavior depends on the chosen hooks. | | Delta / diff-aware | mixed | Hook-based runs are often scoped to staged files, but broader CI parity and baseline behavior depend on how each hook is configured. | | Predictable and updatable linter versions | mixed | Hook revisions can be pinned, but version management lives in separate hook configuration instead of flowing through Renovate updates to `mise.toml`. | -| Local == CI | mixed | Teams often use pre-commit locally but a different command or environment in CI. | +| Local + CI aligned | mixed | Teams often use pre-commit locally but a different command or environment in CI. | ## Husky @@ -86,7 +86,7 @@ with no install step and no language runtime dependency. | Autofix support | hook-dependent | Whether fixes are available depends entirely on the commands wired into the hooks. | | Delta / diff-aware | hook-dependent | It can run on changed or staged files, but only if the hook commands are written that way. | | Predictable and updatable linter versions | hook-dependent | Husky only runs whatever commands the repo wires into hooks, so version stability depends on those underlying tools and how the repo manages them. | -| Local == CI | mixed | Husky is usually local-hook infrastructure, while CI often uses separate scripts or commands. | +| Local + CI aligned | mixed | Husky is usually local-hook infrastructure, while CI often uses separate scripts or commands. | ## Spotless and formatter plugins @@ -112,7 +112,7 @@ clean. | Autofix support | yes, formatter-focused | Formatter plugins are usually good at in-place fixes. | | Delta / diff-aware | usually no | They commonly run at project or module scope rather than being natively optimized around changed-file diffs. | | Predictable and updatable linter versions | usually yes in that ecosystem | Build plugins and formatter versions are often pinned through the build system, but the model is tied to that ecosystem rather than being a general lint-runner property. | -| Local == CI | usually yes in that build | Reusing the same build plugin in local and CI is straightforward when the repo already standardizes on that build system. | +| Local + CI aligned | usually yes in that build | Reusing the same build plugin in local and CI is straightforward when the repo already standardizes on that build system. | ## MegaLinter and super-linter @@ -134,4 +134,4 @@ explicit style ownership instead of a broad kitchen-sink layer. | Autofix support | mixed | Some integrated tools can fix in place, but support varies across the bundled linter set and may be awkward in container workflows. | | Delta / diff-aware | limited / mixed | Some support changed-file or PR-oriented modes, but the model is usually broader and less native than a runner built around git diffs. | | Predictable and updatable linter versions | mixed | The wrapper itself is versioned predictably, but the bundled linter set and containerized execution model can still make upgrades feel more indirect. | -| Local == CI | mixed | CI often uses the canonical containerized flow, while local usage may be slower, less common, or configured differently. | +| Local + CI aligned | mixed | CI often uses the canonical containerized flow, while local usage may be slower, less common, or configured differently. | diff --git a/docs/cli.md b/docs/cli.md index f1be8057..9dfae37d 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -18,7 +18,7 @@ it do not need to re-learn the interface. | -------------------- | -------------------------------------------------------------------------------------------------------------------- | | `--fix` | Fix what's fixable, report `clean` / `fixed` / `partial` / `review` outcomes; exit non-zero if anything needs action | | `--full` | Lint all files instead of only changed files | -| `--fast-only` | Skip checks tagged as slow in the registry. Overridden by explicit linter names. | +| `--fast-only` | Force the filtered local run policy explicitly. Overridden by explicit linter names and `--full`. | | `--short` | Compact summary output, no per-check noise | | `--verbose` | Show all linter output, not just failures | | `--new-from-rev REV` | Diff base (default: merge base with base branch) | @@ -31,15 +31,17 @@ Every flag has an env var equivalent: `FLINT_FIX`, `FLINT_FULL`, `FLINT_FAST_ONL | Context | Command | Why | | ---------------------------- | -------------------------------------- | ----------------------------------------------------------------- | -| Interactive development | `flint run` or `flint run --fast-only` | Full output so you can read the details | +| Interactive development | `flint run` | Full output so you can read the details | | Human wanting a summary | `flint run --short` | Compact output, no per-check noise | -| Pre-push hook (CC / agentic) | `flint run --fix --fast-only` | Fixes what it can silently, surfaces only what needs human review | +| Pre-push hook (CC / agentic) | `flint run --fix` | Fixes what it can silently, surfaces only what needs human review | | CI | `flint run` | Full output for humans reading CI logs | ## Changed-file and baseline runs -By default, `flint run` checks only files changed relative to the merge base. -Use `--full` to check every matching file explicitly. +By default, local `flint run` checks linters triggered by changes relative to +the merge base. In CI, `flint run` activates the full linter set while still +keeping diff-aware scoping where each linter supports it. Use `--full` to +check every matching file explicitly. Some changed-file runs intentionally expand one or more affected checks to all matching files. This establishes a baseline when lint coverage changes, while diff --git a/docs/linters.md b/docs/linters.md index 69e46ae0..e38fbf70 100644 --- a/docs/linters.md +++ b/docs/linters.md @@ -231,7 +231,7 @@ check_all_local = true | Binary | `renovate` | | Scope | [native](#scope-native) | | Patterns | `renovate.json renovate.json5 .github/renovate.json .github/renovate.json5 .renovaterc .renovaterc.json .renovaterc.json5` | -| Run policy | adaptive — runs in `--fast-only` only when relevant | +| Run policy | adaptive — runs in local default runs and `--fast-only` only when relevant | Verifies `renovate-tracked-deps.json` next to the active Renovate config is up to date by running Renovate locally and comparing its @@ -384,11 +384,12 @@ without file arguments or use custom orchestration logic. Checks use one of three run policies: -- `fast` — always runs, including in `--fast-only` -- `slow` — skipped by `--fast-only` -- `adaptive` — runs in `--fast-only` only when the changed files are relevant +- `fast` — always runs, including in local default runs and `--fast-only` +- `slow` — skipped in local default runs and by `--fast-only` +- `adaptive` — runs in local default runs and `--fast-only` only when the changed files are relevant -Use `--fast-only` for local/pre-push feedback and the full set in CI. +Local `flint run` already uses the filtered policy by default. Use `--full`, +an explicit linter name, or CI to run the broader set. **`editorconfig-checker` defers to formatters**: `editorconfig-checker` runs on all files, but automatically skips file types owned by an active formatter. If diff --git a/docs/why.md b/docs/why.md index b4ad9644..ac392895 100644 --- a/docs/why.md +++ b/docs/why.md @@ -19,12 +19,14 @@ This is the primary goal; everything else serves it. - Small binary, cached by mise - Diff-aware by default: changed files only unless `--full` is requested - Opt-in activation: undeclared tools are skipped entirely -- Slow checks can be skipped via `--fast-only` +- Local runs skip slower checks by default unless you use `--full` or name the + linter explicitly -## Local same as CI +## Local and CI stay aligned -One binary, one config model, identical behavior. There is no "native mode -subset" distinction. If it passes locally, it passes in CI. +One binary, one config model, and the same pinned tools in both environments. +Local runs default to the change-triggered subset for day-to-day speed, while +CI activates the full linter set. ## Predictable and updatable linter versions diff --git a/src/hook.rs b/src/hook.rs index 052032ab..87cc72c1 100644 --- a/src/hook.rs +++ b/src/hook.rs @@ -4,7 +4,7 @@ use std::process::Command; const HOOK_CONTENT: &str = "#!/bin/sh\n\ # Installed by flint — run `flint hook install` to reinstall\n\ -mise exec -- flint run --fix --fast-only\n"; +mise exec -- flint run --fix\n"; /// Returns the repository-local pre-commit hook path for this git checkout. pub(crate) fn pre_commit_path(project_root: &Path) -> Result { diff --git a/src/init/scaffold.rs b/src/init/scaffold.rs index 2497948e..4abb70bb 100644 --- a/src/init/scaffold.rs +++ b/src/init/scaffold.rs @@ -182,9 +182,7 @@ pub(super) fn maybe_install_hook(project_root: &Path, yes: bool) -> Result<()> { let install = if yes { true } else { - print!( - "Install pre-commit hook (runs `flint run --fix --fast-only` before each commit)? [Y/n] " - ); + print!("Install pre-commit hook (runs `flint run --fix` before each commit)? [Y/n] "); io::stdout().flush()?; let mut input = String::new(); io::stdin().lock().read_line(&mut input)?; diff --git a/src/linters/renovate_deps/mod.rs b/src/linters/renovate_deps/mod.rs index 787a26d3..038773f1 100644 --- a/src/linters/renovate_deps/mod.rs +++ b/src/linters/renovate_deps/mod.rs @@ -50,7 +50,7 @@ struct PreparedRenovateDeps { } fn prepare(ctx: NativePrepareContext<'_>) -> Option> { - if !is_relevant(ctx.file_list, ctx.project_root) { + if ctx.filtered_run_policy && !is_relevant(ctx.file_list, ctx.project_root) { return None; } diff --git a/src/main.rs b/src/main.rs index dfeaaf1a..c17e98a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ mod setup; use anyhow::Result; use clap::{Args, Parser, Subcommand}; use registry::{CheckKind, FixBehavior, LinterConfig, RunPolicy, Scope}; -use runner::{CheckResult, RunOptions}; +use runner::{CheckResult, RunContext as RunnerRunContext, RunOptions}; use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; @@ -44,7 +44,7 @@ struct HookArgs { #[derive(Subcommand, Debug)] enum HookCommand { - /// Install a pre-commit hook that runs `flint run --fix --fast-only`. + /// Install a pre-commit hook that runs `flint run --fix`. Install, } @@ -87,7 +87,8 @@ struct RunArgs { #[arg(long, env = "FLINT_FULL")] full: bool, - /// Run only fast linters. Overridden by explicitly named linters. + /// Run only fast linters. Local `flint run` already does this by default. + /// Overridden by explicitly named linters and `--full`. #[arg(long, env = "FLINT_FAST_ONLY")] fast_only: bool, @@ -127,6 +128,14 @@ impl From<&RunArgs> for FixSummaryOptions { } } +fn use_filtered_run_policy(args: &RunArgs, explicit: bool, is_ci: bool) -> bool { + if explicit || args.full { + return false; + } + + args.fast_only || !is_ci +} + #[tokio::main] async fn main() -> Result<()> { let cli = Cli::parse(); @@ -188,7 +197,7 @@ async fn run( let cfg = config::load(config_dir)?; // Filter registry to requested linters (or all if none specified). - // Explicit linter names override --fast-only (same behaviour as golangci-lint). + // Explicit linter names bypass filtered local defaults (same behaviour as golangci-lint). let explicit = !args.linters.is_empty(); let checks: Vec<®istry::Check> = if explicit { let mut out = vec![]; @@ -215,9 +224,12 @@ async fn run( )?; // Discover which checks are declared in the consuming repo's mise.toml, and apply - // --fast-only policy (skipped when linters are named explicitly, relevance-gated for - // adaptive checks). mise guarantees declared tools are on PATH, so no PATH check needed. + // filtered-run policy when enabled. Outside CI, plain `flint run` defaults to the + // same filtering as `--fast-only`; explicit linter names and `--full` always bypass it. + // mise guarantees declared tools are on PATH, so no PATH check needed. let mise_tools = registry::read_mise_tools(project_root); + let is_ci = linters::env::is_ci_from(|name| std::env::var(name).ok()); + let use_filtered_policy = use_filtered_run_policy(&args, explicit, is_ci); let flint_setup_selected = checks.iter().any(|c| c.kind.is_setup()); if !flint_setup_selected { if let Some((old, new)) = registry::find_obsolete_key(&mise_tools) { @@ -240,7 +252,7 @@ async fn run( }; for c in checks { if registry::check_active(c, &mise_tools) { - let include = if explicit || !args.fast_only { + let include = if !use_filtered_policy { true } else { match c.run_policy { @@ -280,11 +292,12 @@ async fn run( short: args.short, time: args.time, }, - RunContext { + ExecutionContext { active_checks: &active, project_root, cfg: &cfg, config_dir, + filtered_run_policy: false, }, ) .await?; @@ -375,11 +388,12 @@ async fn run( } else { Some(files::all(project_root, &cfg)?) }; - let run_ctx = RunContext { + let run_ctx = ExecutionContext { active_checks: &active, project_root, cfg: &cfg, config_dir, + filtered_run_policy: use_filtered_policy, }; if args.fix { @@ -541,11 +555,12 @@ async fn run( } #[derive(Clone, Copy)] -struct RunContext<'a> { +struct ExecutionContext<'a> { active_checks: &'a [&'a registry::Check], project_root: &'a Path, cfg: &'a config::Config, config_dir: &'a Path, + filtered_run_policy: bool, } #[derive(Clone, Copy)] @@ -744,7 +759,7 @@ async fn run_checks( baseline_file_list: Option<&files::FileList>, baseline_names: &HashSet, opts: RunOptions, - ctx: RunContext<'_>, + ctx: ExecutionContext<'_>, ) -> Result> { let (baseline, normal): (Vec<_>, Vec<_>) = checks .iter() @@ -756,12 +771,15 @@ async fn run_checks( results.extend( runner::run( &normal, - ctx.active_checks, - file_list, + RunnerRunContext { + active_checks: ctx.active_checks, + file_list, + filtered_run_policy: ctx.filtered_run_policy, + project_root: ctx.project_root, + cfg: ctx.cfg, + config_dir: ctx.config_dir, + }, opts, - ctx.project_root, - ctx.cfg, - ctx.config_dir, ) .await?, ); @@ -771,12 +789,15 @@ async fn run_checks( results.extend( runner::run( &baseline, - ctx.active_checks, - files, + RunnerRunContext { + active_checks: ctx.active_checks, + file_list: files, + filtered_run_policy: false, + project_root: ctx.project_root, + cfg: ctx.cfg, + config_dir: ctx.config_dir, + }, opts, - ctx.project_root, - ctx.cfg, - ctx.config_dir, ) .await?, ); @@ -1183,9 +1204,26 @@ fn display_binary(check: ®istry::Check) -> &'static str { #[cfg(test)] mod tests { - use super::{display_binary, linter_status, render_linters_table}; + use super::{ + RunArgs, display_binary, linter_status, render_linters_table, use_filtered_run_policy, + }; use crate::{config, registry}; + fn run_args() -> RunArgs { + RunArgs { + fix: false, + allow_fixed: false, + full: false, + fast_only: false, + verbose: false, + short: false, + new_from_rev: None, + to_ref: None, + time: false, + linters: Vec::new(), + } + } + fn mise_tools_from(content: &str) -> std::collections::HashMap { let dir = tempfile::tempdir().expect("tempdir"); std::fs::write(dir.path().join("mise.toml"), content).expect("write mise.toml"); @@ -1303,4 +1341,37 @@ license-header (built-in) not configured fast no Check s .expect("license-header check"); assert_eq!(display_binary(&license_header), "(built-in)"); } + + #[test] + fn filtered_run_policy_is_default_outside_ci() { + assert!(use_filtered_run_policy(&run_args(), false, false)); + } + + #[test] + fn filtered_run_policy_is_disabled_by_default_in_ci() { + assert!(!use_filtered_run_policy(&run_args(), false, true)); + } + + #[test] + fn filtered_run_policy_is_disabled_for_full_runs() { + let mut args = run_args(); + args.full = true; + + assert!(!use_filtered_run_policy(&args, false, false)); + assert!(!use_filtered_run_policy(&args, false, true)); + } + + #[test] + fn filtered_run_policy_is_disabled_for_explicit_linter_selection() { + assert!(!use_filtered_run_policy(&run_args(), true, false)); + assert!(!use_filtered_run_policy(&run_args(), true, true)); + } + + #[test] + fn fast_only_enables_filtered_run_policy_in_ci() { + let mut args = run_args(); + args.fast_only = true; + + assert!(use_filtered_run_policy(&args, false, true)); + } } diff --git a/src/registry/tests.rs b/src/registry/tests.rs index ad76ef41..d40f911c 100644 --- a/src/registry/tests.rs +++ b/src/registry/tests.rs @@ -1016,12 +1016,16 @@ fn detail_rows(check: &Check) -> Vec<(&'static str, String)> { match check.run_policy { crate::registry::RunPolicy::Fast => {} crate::registry::RunPolicy::Slow => { - rows.push(("Run policy", "slow — skipped by `--fast-only`".to_string())); + rows.push(( + "Run policy", + "slow — skipped in local default runs and by `--fast-only`".to_string(), + )); } crate::registry::RunPolicy::Adaptive => { rows.push(( "Run policy", - "adaptive — runs in `--fast-only` only when relevant".to_string(), + "adaptive — runs in local default runs and `--fast-only` only when relevant" + .to_string(), )); } } diff --git a/src/registry/types.rs b/src/registry/types.rs index c0938d87..44a0f0ef 100644 --- a/src/registry/types.rs +++ b/src/registry/types.rs @@ -255,6 +255,7 @@ pub trait CheckType: Sync + std::fmt::Debug { pub struct NativePrepareContext<'a> { pub name: &'static str, pub file_list: &'a FileList, + pub filtered_run_policy: bool, pub project_root: &'a Path, pub cfg: &'a Config, pub config_dir: &'a Path, diff --git a/src/runner.rs b/src/runner.rs index 7daf0459..5ee0339b 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -21,6 +21,16 @@ pub struct RunOptions { pub time: bool, } +#[derive(Clone, Copy)] +pub struct RunContext<'a> { + pub active_checks: &'a [&'a Check], + pub file_list: &'a FileList, + pub filtered_run_policy: bool, + pub project_root: &'a Path, + pub cfg: &'a Config, + pub config_dir: &'a Path, +} + #[derive(Clone)] pub struct CheckResult { pub name: String, @@ -141,12 +151,8 @@ impl PreparedCheck { pub async fn run( checks: &[&Check], - active_checks: &[&Check], - file_list: &FileList, + ctx: RunContext<'_>, opts: RunOptions, - project_root: &Path, - cfg: &Config, - config_dir: &Path, ) -> Result> { let RunOptions { fix, @@ -159,12 +165,13 @@ pub async fn run( .filter_map(|&check| { prepare( check, - file_list, + ctx.file_list, + ctx.filtered_run_policy, fix, - project_root, - active_checks, - cfg, - config_dir, + ctx.project_root, + ctx.active_checks, + ctx.cfg, + ctx.config_dir, ) }) .collect(); @@ -172,7 +179,7 @@ pub async fn run( if fix { let mut results = vec![]; for task in prepared { - let r = task.execute(fix, verbose, project_root).await; + let r = task.execute(fix, verbose, ctx.project_root).await; if !short && (verbose || !r.ok) { eprintln!("[{}]{}", r.name, format_duration_suffix(time, r.duration)); flush_output(&r.stdout, &r.stderr); @@ -184,7 +191,7 @@ pub async fn run( let mut set: JoinSet = JoinSet::new(); for task in prepared { - let root = project_root.to_path_buf(); + let root = ctx.project_root.to_path_buf(); set.spawn(async move { task.execute(false, verbose, &root).await }); } @@ -214,6 +221,7 @@ pub async fn run( fn prepare( check: &Check, file_list: &FileList, + filtered_run_policy: bool, fix: bool, project_root: &Path, active_checks: &[&Check], @@ -251,6 +259,7 @@ fn prepare( .prepare(NativePrepareContext { name: check.name, file_list, + filtered_run_policy, project_root, cfg, config_dir, diff --git a/tests/cases/general/hook-install/test.toml b/tests/cases/general/hook-install/test.toml index 00ba0295..f96ba356 100644 --- a/tests/cases/general/hook-install/test.toml +++ b/tests/cases/general/hook-install/test.toml @@ -7,5 +7,5 @@ stdout = "installed pre-commit hook (.git/hooks/pre-commit)\n" ".git/hooks/pre-commit" = ''' #!/bin/sh # Installed by flint — run `flint hook install` to reinstall -mise exec -- flint run --fix --fast-only +mise exec -- flint run --fix ''' diff --git a/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/.github/renovate-tracked-deps.json b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/.github/renovate-tracked-deps.json new file mode 100644 index 00000000..ab5dd26e --- /dev/null +++ b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/.github/renovate-tracked-deps.json @@ -0,0 +1,11 @@ +{ + "meta": {}, + "files": { + "package.json": { + "npm": [ + "express", + "lodash" + ] + } + } +} diff --git a/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/.github/renovate.json5 b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/.github/renovate.json5 new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/.github/renovate.json5 @@ -0,0 +1 @@ +{} diff --git a/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/README.md b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/README.md new file mode 100644 index 00000000..8ae05696 --- /dev/null +++ b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/README.md @@ -0,0 +1 @@ +# Test diff --git a/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/mise.toml b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/mise.toml new file mode 100644 index 00000000..e9ee820b --- /dev/null +++ b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/mise.toml @@ -0,0 +1,5 @@ +[tools] +node = "22.0.0" + +# Linters +"npm:renovate" = "43.136.3" diff --git a/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/package.json b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/package.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/files/package.json @@ -0,0 +1 @@ +{} diff --git a/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/test.toml b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/test.toml new file mode 100644 index 00000000..6029f235 --- /dev/null +++ b/tests/cases/renovate-deps/ci-default-runs-even-when-irrelevant/test.toml @@ -0,0 +1,18 @@ +[expected] +args = "run" +exit = 0 + +[expected.files] +".renovate-ran" = """ +""" + +[env] +CI = "true" +GITHUB_TOKEN = "token" + +[fake_bins] +renovate = ''' +#!/bin/sh +touch .renovate-ran +printf '%s\n' '{"msg":"Extracted dependencies","packageFiles":{"npm":[{"packageFile":"package.json","deps":[{"depName":"express"},{"depName":"lodash"}]}]}}' +''' diff --git a/tests/cases/renovate-deps/local-default-relevant/changes/package.json b/tests/cases/renovate-deps/local-default-relevant/changes/package.json new file mode 100644 index 00000000..a4ba2127 --- /dev/null +++ b/tests/cases/renovate-deps/local-default-relevant/changes/package.json @@ -0,0 +1,3 @@ +{ + "name": "changed" +} diff --git a/tests/cases/renovate-deps/local-default-relevant/files/.github/renovate-tracked-deps.json b/tests/cases/renovate-deps/local-default-relevant/files/.github/renovate-tracked-deps.json new file mode 100644 index 00000000..ab5dd26e --- /dev/null +++ b/tests/cases/renovate-deps/local-default-relevant/files/.github/renovate-tracked-deps.json @@ -0,0 +1,11 @@ +{ + "meta": {}, + "files": { + "package.json": { + "npm": [ + "express", + "lodash" + ] + } + } +} diff --git a/tests/cases/renovate-deps/local-default-relevant/files/.github/renovate.json5 b/tests/cases/renovate-deps/local-default-relevant/files/.github/renovate.json5 new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/cases/renovate-deps/local-default-relevant/files/.github/renovate.json5 @@ -0,0 +1 @@ +{} diff --git a/tests/cases/renovate-deps/local-default-relevant/files/mise.toml b/tests/cases/renovate-deps/local-default-relevant/files/mise.toml new file mode 100644 index 00000000..e9ee820b --- /dev/null +++ b/tests/cases/renovate-deps/local-default-relevant/files/mise.toml @@ -0,0 +1,5 @@ +[tools] +node = "22.0.0" + +# Linters +"npm:renovate" = "43.136.3" diff --git a/tests/cases/renovate-deps/local-default-relevant/files/package.json b/tests/cases/renovate-deps/local-default-relevant/files/package.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/cases/renovate-deps/local-default-relevant/files/package.json @@ -0,0 +1 @@ +{} diff --git a/tests/cases/renovate-deps/local-default-relevant/test.toml b/tests/cases/renovate-deps/local-default-relevant/test.toml new file mode 100644 index 00000000..001c5d24 --- /dev/null +++ b/tests/cases/renovate-deps/local-default-relevant/test.toml @@ -0,0 +1,17 @@ +[expected] +args = "run" +exit = 0 + +[expected.files] +".renovate-ran" = """ +""" + +[env] +GITHUB_TOKEN = "token" + +[fake_bins] +renovate = ''' +#!/bin/sh +touch .renovate-ran +printf '%s\n' '{"msg":"Extracted dependencies","packageFiles":{"npm":[{"packageFile":"package.json","deps":[{"depName":"express"},{"depName":"lodash"}]}]}}' +''' diff --git a/tests/e2e.rs b/tests/e2e.rs index 1c36d531..bcc4c82b 100644 --- a/tests/e2e.rs +++ b/tests/e2e.rs @@ -168,7 +168,7 @@ fn cases() { // marks it executable with Unix permissions. #[cfg(unix)] #[test] -fn renovate_deps_fast_only_runs_for_deleted_tracked_file() { +fn renovate_deps_local_default_runs_for_deleted_tracked_file() { let repo = git_repo(); std::fs::create_dir_all(repo.path().join(".github")).unwrap(); @@ -250,11 +250,7 @@ printf '%s\n' '{"msg":"Extracted dependencies","packageFiles":{"mise":[{"package fake_bin_dir.path().display(), std::env::var("PATH").unwrap_or_default() ); - let out = flint_with_env( - &["run", "--fast-only"], - repo.path(), - &[("PATH", &fake_path)], - ); + let out = flint_with_env(&["run"], repo.path(), &[("PATH", &fake_path)]); assert!( repo.path().join(".renovate-ran").exists(),