Skip to content

v3.46.0: fallow explain code examples, threshold override comments, includeEntryExports through export *, health --css broken references

Choose a tag to compare

@BartWaardenburg BartWaardenburg released this 21 Nov 22:41
· 154 commits to main since this release
Immutable release. Only release title and notes can be modified.
v3.46.0
965f068

Features

  • A fallow-override-threshold-next-line comment sets the health ceilings of one function. Write // fallow-override-threshold-next-line maxCognitive=40 maxCrap=45 -- <reason> on the line before the function. The keys are the keys of health.thresholdOverrides (maxCyclomatic, maxCognitive, maxCrap, maxUnitSize), and the reason is required. For each ceiling that it sets, the comment wins over a config entry. The health report lists each comment in the new optional inline_threshold_overrides array. A comment with a problem, for example a missing reason, has no effect and goes to the new optional inline_threshold_override_problems array. A finding that a comment ceiling applies to has override_comment_line, and the human report shows override (comment, line N) or override (config). To turn the comment form off, set health.inlineThresholdOverrides (default true) to false. fallow audit reports a new comment through the added-suppression rule. Thanks @DiefBell for the request. (#4898)
  • fallow explain shows a tested code example for each rule. fallow explain <id> now prints the files of a small project that makes the rule report a finding. A rule of fallow audit shows the files before and after the change. --format json and fallow schema --cli-reference have the files in the new example_files and example_base_files arrays. A rule has no example when it needs data that a small project does not have, such as production runtime data or a test run. (#4932)
  • fallow health --css reports css-broken-reference. The --css section now runs the project-wide stylesheet pass. Health then reports an animation that names a @keyframes rule that no stylesheet defines. It also reports a markup class that is one edit away from a defined class. The pass also adds the other cross-file styling findings, such as unused theme tokens. With --changed-since, health --css scans every stylesheet and reports only the findings in the changed files. The MCP check_health tool does the same when css is true. (#4944)
  • fallow security reports the usual forms of a sink call. Calls such as new Handlebars.SafeString(x), this.sanitizer.bypassSecurityTrustHtml(x), $("#p").html(x) and console.log("login", secret) now give a candidate. A sink behind this., a call result or a local alias gets the same candidate as the plain form. Matcher rows now state their forms and arguments. A call of a member of this itself, such as this.query(x), matches only the rows that set the new this_receiver field. Fallow also reads the callees behind this. and call results for security controls and framework request sources. For example, this.router.get("/", handler) now marks req as request input. (#4940)
  • New uses that fallow dead-code reads. A coderabbit plugin keeps .coderabbit.config.ts in use when the project depends on @coderabbitai/config. A gnome-shell-extension plugin makes extension.js and prefs.js entry points in each folder whose metadata.json has the uuid and shell-version keys. Fallow reads the lifecycle commands of development container files, such as .devcontainer/devcontainer.json, and the scripts[].command values of a t3.json file as package.json scripts. A file that code names with a path below the module directory, such as path.join(__dirname, "../scripts/agent.mjs"), is no longer an unused file. Fallow also reads the script files of a process call whose cwd option is such a directory. (#4912)
  • Unused exports in generated files and in shadcn/ui folders name the config entry that hides them. Fallow keeps these findings in the report. The human report prints one ignoreExports hint for each group of 3 findings or more. In JSON, each such finding has an add-to-config action. An unused export or unused type in a generated file has auto_fixable: false on its remove-export action. It has no suppress-line action, because the generator writes the file again. (#4912)
  • fallow schema tells source edits apart from report writes. Each mcp_tools and fallow://tools row has a new modifies_source field, which is true only for fix_apply. The read_only field and the MCP readOnlyHint annotation do not change. In fallow schema and fallow schema --cli-reference, each deprecated command and option now has a deprecated object with the replacement. (#4845)

Changed

  • The docs link of each issue type opens its rule page. fallow explain, --explain, the SARIF helpUri, the LSP, the MCP fallow://issue-types resource, fallow schema, the human report and the GitHub summary now link to https://fallow.tools/docs/rules/<id>/. The old links still work. (#4894)
  • The fallow dead-code options for the architecture issue types are deprecated. --circular-deps, --re-export-cycles, --package-cycles, --boundary-violations and --policy-violations print one stderr warning each with the fallow architecture option to use. --quiet removes the warning. The next major version removes these options.
  • A config with minimumVersion 3.34.0 or higher no longer gets the single-segment glob warning. Such a config tells fallow that its globs are written for the one-level * rule of 3.34.0. The globs of plugins and rule packs keep the warning. (#4851)
  • A dead-code report with only warnings says why the exit code stays 0. The human report prints "Warnings do not change the exit code. Set a rule to error to fail on it." Machine formats and --quiet runs do not change. (#4905)
  • An entry point from a CI file now names that CI file as its source. fallow list --entry-points prints tools/release.ts (.github/workflows/ci.yml) instead of tools/release.ts (scripts), and the JSON source field changes the same way. Entry points from package.json scripts keep their label. (#4845)
  • The built-in ignore list now has the root fallow-viz.html. Fallow no longer analyzes the map that fallow viz writes. To analyze the file again, add "!fallow-viz.html" to ignorePatterns. (#4845)
  • fallow fix --format json has new skip reasons for catalog records. It emits not_found, not_empty, unsupported_yaml_style and unsafe_edit, and no longer emits line_out_of_range. An edit that would change other parts of pnpm-workspace.yaml is now a skip with unsafe_edit, not a write error with exit code 2.
  • fallow fix edits exports and enum members only in a file that parses without an error. A file with a syntax error, an MDX file and a Glimmer file keep their export keywords, and the finding stays in the report. This rule does not apply to export lists such as export { a, b }. The editor does not offer the quick fix "Remove unused export" in a document with a syntax error. The quick fix now also works for the second declaration on a line. fallow fix --dry-run lists an unused exported enum with only unused members one time.
  • fallow audit reads its git diff one time for attribution. A change of a saved-baseline path also keeps the cached base result, because the base pass reads no saved baseline.
  • Rust crates: changes for library callers. ConfigLoadOptions and ConfigFileOptions have the time limit of a remote extends fetch, are #[non_exhaustive] and have new constructors. Four ResolvedConfig mutators are #[doc(hidden)]. Session loaders without a resolved run need the testing feature. Some project config helpers, cache_dir_env_override and ProductionEnv::from_process are removed. Open a session with fallow_api::run::resolve_run, then Runnable::open_session or EditorAnalysisSession::open.

Bug fixes

  • includeEntryExports now checks the names that an entry file re-exports with export *. An export * line of an entry file now counts only for the names that an importer uses, and fallow reports each other name at its declaration. See the upgrade notes. (#4986)
  • includeEntryExports now checks the enum, class and namespace members of an export that an entry file declares. publicPackages now also removes the unused-namespace-member findings of the public exports of a package. See the upgrade notes. (#4990)
  • publicPackages no longer hides dead code that the entry points of a public package cannot reach. Fallow now reports the other unused exports, types, class members and enum members in the package. Unused-file findings do not change. (#4849)
  • fallow security --gate new now fails when a change adds a secret read or a server-only import below line 1 of an existing client module. A client-server-leak candidate now points at that read or import, and a secret-source trace hop has a new secret_reads array. (#4881)
  • The stable_finding_id of a direct client-server-leak candidate now holds the names of the env secrets. A verdict for one secret no longer covers a secret that a later edit adds. Thanks @cr101 for the report. (#4953)
  • A secret read in a React Router loader no longer gives a candidate in the computed or the destructured form. Fallow checks process.env['X'] and const { X } = process.env the same as process.env.X. (#4882)
  • A React Router .server sink gets React Router advice. The Next: step tells you to move the call into loader, action, middleware or headers, or to move the code that the client needs out of the .server module. Thanks @cr101 for the report. (#4954)
  • fallow security --runtime-coverage uses the settings of its own run for the runtime coverage step. A value such as FALLOW_CACHE_DIR now reaches that step. (#4875)
  • fallow dead-code no longer reports react as unused when the automatic JSX runtime uses it. Fallow credits react for a JSX file without a runtime pragma below a tsconfig with jsx set to react-jsx or react-jsxdev and no jsxImportSource. Fallow also credits react for such a file in a package where Next.js is active. (#4943)
  • A CSS Modules file is no longer unused when another CSS Modules file composes from it. composes: base rounded from "./shared.module.css" adds an import edge and marks base and rounded as used. (#4844)
  • fallow dead-code no longer reports a type that the inferred type of a used export needs. Fallow follows a held binding through property values, returns, class fields, typed calls, export default and property reads. With private-type-leaks on, such a type that is not exported is now a private type leak. (#4850)
  • A computed key credits the right class members. For view[action]() with action of type "zoomIn" | "zoomOut", fallow credits only those members. When two functions each declare a local of the same name, fallow credits the class that the local holds at the read. (#4812, #4824)
  • A manual mock and its module are no longer duplicate exports. Fallow removes a Jest, Vitest or Rstest mock in __mocks__/ from a duplicate-exports group that also has its module. (#4855)
  • An entry list that a config picks with a conditional expression now gives its entry points. Fallow reads both branches of entry: isBootstrap ? [...] : [...]. This applies to each plugin that reads paths from a config, such as the pack.entry of Vite+ and the build.lib.entry of Vite. (#4912)
  • A CI step that puts a node_modules/.bin path in a shell variable now credits the package. The assignment bundler=scripts/node_modules/.bin/esbuild counts as the use of the binary. (#4912)
  • An Expo app no longer needs a config entry for its fingerprint config, its font packages and its native-only modules. Fallow keeps fingerprint.config.js in use and credits installed font packages and expo-module.config.json modules that the app declares. (#4912)
  • effect.schemaExportsAsTypes accepts a schema that a function call builds. export const User = makeUser() is a schema when each return of makeUser is a schema. A return can call a second such function, to a depth of 4 functions. A let or var binding that the module assigns again is no longer a schema, because its value is unknown. (#4988)
  • A > in a brace attribute of a Svelte <script> element no longer breaks the parse. The file no longer gets source-parse-degraded, so the findings of the run no longer get the incomplete-import-graph caveat. (#4828)
  • fallow audit no longer reports an old unused export behind a SvelteKit path alias as introduced. The base snapshot now has .svelte-kit/tsconfig.json and the node_modules of each workspace package. (#4790)
  • fallow audit no longer passes silently in a shallow clone without a base. It prints a warning on stderr, also under --quiet. The warning names fetch-depth: 0 and --base <ref>. The JSON output reports gate_outcomes["audit-verdict"].status as skipped, and the exit code stays 0. (#4839)
  • fallow audit no longer reuses a cached base result of another type-aware selection or of old coverage dumps. The cache key now has the effective type-aware selection and each coverage file of --coverage <dir>.
  • A changed file with a non-ASCII character or a space in its name is in the diff scope. Diff-scoped results, fallow audit, fallow security --gate new and the review comments now find such a file. The change anchors of fallow audit --brief for a file with a space in its name get new ids one time.
  • Other diff fixes. An added line that starts with ++ no longer stops the base-line mapping, fallow audit --brief compares a moved package.json with its old path, and the --diff-file warning for a diff without added lines names the findings that stay.
  • A diff scope and --workspace narrow more finding types. A diff scope now narrows boundary, policy, thin-wrapper and duplicate-prop-shape findings. It also reports a route conflict that a pure rename creates. With --workspace, fallow now also narrows prop-drilling chains, thin wrappers and duplicate prop shapes to the selected workspaces.
  • The summary lines of the human output agree with the result of the run. The Failed: line of a bare fallow run names only the analyses that fail the run, and the health status line counts only the functions that the baseline does not accept. (#4837)
  • The CLI gate line and the MCP warnings sentence show the same gate facts. Both round a fractional gate number to two decimals and show the mutation score with one decimal, rounded down. Neither shows a number as equal to a different threshold. Entries without enforced or status get the same treatment on both. (#4874)
  • The SARIF of a bare fallow run and of fallow audit has a location per clone. The duplication run now has the shape of fallow dupes --format sarif, with a declared fallow/code-duplication rule. (#4873)
  • A re-export-cycle finding has the line of the re-export that closes the cycle. JSON adds line and col, SARIF adds a region, and CodeClimate, github-annotations and the review comments use the line. (#4941)
  • The CLI reference names fallow architecture for the architecture issue types. The cycle, boundary and policy rows now give command: "architecture", and the new deprecated_filter_flag field keeps the old option. (#4883)
  • The output schema and the issue registry describe the JSON that the commands print. Each root output definition has an optional kind property, and fallow schema marks unused-catalog-entry as suppressible. (#4846)
  • --sarif-file exits 2 on a command that writes no SARIF file. To get SARIF from fallow audit, use --format sarif with --output-file. (#4845)
  • fallow dupes and other commands reject the regression flags instead of a silent run. These commands exit with code 2. The error names the commands that support the flags, and for fallow dupes and fallow health it also names --baseline. (#4931)
  • A bare fallow --format badge run prints one error and exits with code 2. fallow --only health --score --format badge still renders the badge. (#4845)
  • Small CLI output fixes. fallow trace --path with no route prints "No import path." once, and the schema commands exit cleanly on a closed pipe. --quiet hides two more warnings, and fallow fix lists its entries in path order. fallow flags no longer reports boundaries-not-configured and rule-packs-not-configured. fallow inspect prints key: value fields, fallow impact status prints a short view, and fallow list --boundaries shows the root of a zone. (#4845)
  • A report or baseline path in /tmp works on macOS. Each Unix now allows /tmp for baselines, snapshots and report files. (#4845)
  • Path globs match as their text says. A leading ./ on a path glob matches the same files as the pattern without it. An autoDiscover zone for app/[id] matches only app/[id]. A negated workspace pattern and a tsconfig include or exclude entry keep * inside one folder level. Recursive workspace patterns work in a checkout path with [, * or ?. The Convex functions folder, the Wrangler main file and the Mintlify docs folder are literal paths.
  • --workspace '!<nested>' excludes a workspace below a selected workspace. A nested workspace that no workspaces.settings key selects now uses the global settings.
  • Fallow reads flow-style values in pnpm-workspace.yaml. A flow-style catalog group is no longer reported as empty, and flow-style packages and overrides now count.
  • fallow fix and the editor quick fix edit pnpm-workspace.yaml safely. fallow fix no longer deletes an unrelated setting. Both tools now keep an emptied catalog as a mapping and remove all value lines of a removed entry.
  • fallow fix no longer breaks an export. It keeps export default function () {}, export default class {} and export * as ns from './x' as they are. It removes the export of the right declaration on a shared line. When an earlier edit removed lines, it puts each later edit on the right line. For export /* values */ const live = 1, dead = 2;, it reports dead with skip_reason: "shared_declaration_in_use".
  • fallow fix no longer breaks an enum or changes the value of a kept member. Low, Medium, High with Low unused becomes Medium = 1, High. When the old value is not a known integer, fallow fix keeps the whole enum as it is. (#4963)
  • fallow fix no longer edits a generated file. It reports such a file as skipped with skip_reason: "generated_source". (#4912)
  • The editor quick fix "Remove unused export" no longer breaks code. It is not offered for anonymous default exports, or for a declaration with a used name.
  • GitHub and GitLab review comments offer a suggestion block only when the parser confirms that the edit is safe. In each other case the comment keeps its text and its fix intent.
  • The GitHub Action and the GitLab template add the workspace name to the sticky comment marker. Parallel jobs for different workspaces no longer edit the same comment. See the upgrade notes. (#4845)
  • The GitLab template works with a fallow version range or latest when FALLOW_COMMENT, FALLOW_REVIEW or FALLOW_MUTATION is on. It reads the version of the installed fallow and downloads the scripts of that release. (#4841)
  • The GitHub Action names the input that stops the "SARIF upload skipped" warning. The warning says To stop this warning, set sarif: false. (#4845)
  • An expired or invalid license no longer blocks a single local runtime coverage capture. Fallow prints the license problem as a warning. A run with more than one capture still needs a valid license. A function without V8 tracking now gets review_required, not safe_to_delete. (#4843)
  • fallow health --coverage reads more V8 dumps. It decodes escaped source paths and skips only a malformed source-map-cache entry. It adds the counts of a script that one dump records two times. It resolves a relative source against the directory of an external source map.
  • fallow health --hotspots gives the same churn from the cache as from a --no-cache run. Two roots that share one FALLOW_CACHE_DIR no longer read the churn of each other.
  • Ownership identifies each person correctly. It follows .mailmap, health.ownership.botPatterns matches the local part of the email, and handle mode keeps a plus tag. The audit brief compares the git identity of the reviewer with the contributor, so the anonymized mode and disambiguated handles do not hide a match.
  • Health baselines hide only the findings that they match. Identity mode no longer lets one slot hide two findings. fallow baselines prune keeps the slot of an unnamed function that covers a named function. The baseline_staleness counts agree with the findings that the baseline hides.
  • --group-by section merges repeated GitLab CODEOWNERS section headers. A CODEOWNERS file with a UTF-8 byte order mark keeps its first line.
  • A focused duplication run reports its totals against the full project. This applies to a project with 1024 or more files. The percentage of such a run can be lower than before.
  • --save-regression-baseline keeps the other settings of a JSON config. A config that does not parse now stops the save with an error and exit code 2. The fallow.toml save also writes analysisIdentity and the boundary, policy and cycle counts.
  • Fallow keeps files that it cannot use. fallow flags --retirement and fallow list --entry-weight stop with exit code 2 before they replace an unusable regression baseline, and fallow dead-code warns. fallow audit --walkthrough --mark-viewed keeps an unreadable ledger, and fallow cloud login and logout keep a newer credentials file. fallow init appends .fallow/ to a .gitignore that is not UTF-8.
  • fallow report no longer erases the saved report when --output-file names the --from file. It exits 2 before it opens anything.
  • fallow coverage setup no longer overwrites a coverage recipe that it did not write. The final step says what it did with docs/collect-coverage.md.
  • fallow agent install keeps the other MCP servers in an inline mcp_servers table. fallow agent status names an MCP settings file that does not parse.
  • fallow impact commands handle their store safely. A failed save exits 2, a reset stays reset, and a damaged store is not overwritten. fallow impact --all counts a store from a newer fallow as unreadable.
  • fallow migrate keeps the gate of the source config. The migrated config sets unused-dev-dependencies, unused-namespace-members, unlisted-binaries and duplicate-export-aliases to error, unless the source config says otherwise. (#4905)
  • fallow migrate and fallow init --toml write configs that load. A severity such as "Warning" becomes warn. An unknown value gives a warning, and fallow does not migrate that rule. A line break in a source path stays inside the Migrated from comment. fallow migrate --toml now writes each migrated setting, and fallow init --toml escapes workspace globs.
  • The Git pre-commit hook prints the version floor message on one line. The resolver reads the version from the first line only.
  • fallow dead-code --performance puts the config load and the workspace discovery in the config span. workspaces is now a child of config.
  • The VS Code views show the result of the current run. The extension drops a result that ended after the user disabled the feature, ran Clear Coverage or started a newer run. The Health and Security Candidates views run again after a change of fallow.production, fallow.configPath, fallow.changedSince, fallow.workspace, fallow.allowRemoteExtends or the workspace picker.
  • fallow viz panels match the current view. One click on blank canvas closes the road panel, and the strip of unconnected folders opens for a lens that flags files in it. A URL hash edit closes an open clone or road detail, and a switch to the map view during a camera move keeps the map.
  • Help, config and explain texts no longer mislead. This covers --lean, fallow setup-hooks, duplicates.ignoreDefaults, ignoreDependencies, codeowners, effect.schemaExportsAsTypes, the GitHub Action inputs and four fallow explain examples. (#4856)
  • fallow viz: Enter in the graph search works while a file is selected. Enter selects the shortest match other than the selected file and opens its file view. Focus stays in the search box. (#5002)
  • A pure-rename diff no longer gets an empty-scope warning beside a finding. request_outcomes.diff-filter.scope_size counted only added lines, so a diff that renames a file gave 0. scope_size now also counts each touched file that adds no line. It is 0 only when the diff touches no file and adds no line. (#4974)

Upgrade notes

  • includeEntryExports can give new findings. A project that sets the option can get new unused-export, unused-type and unused-member findings and exit with code 1, and a saved baseline does not have them. To keep a name, add an importer, list the package in publicPackages, put /** @public */ on the declaration, or add an ignoreExports rule for the source file. An ignoreExports rule for the entry file with "exports": ["*"] credits each name behind its export * lines. To keep a member, add a use, list the package in publicPackages, or add // fallow-ignore-next-line with the rule name. fallow fix removes the export keyword of a reported name, so check that no code outside the project imports it. (#4986, #4990)
  • publicPackages can give new findings. Fallow reports the unused code that the entry points of a public package cannot reach. (#4849)
  • The first run after the upgrade parses each file again. The extraction cache and graph cache versions change, and the churn cache moves to version 10.
  • Replace the deprecated fallow dead-code architecture options. Use the fallow architecture option that the warning names.
  • Some flag combinations now exit with code 2. This applies to --sarif-file on a command that writes no SARIF, to unsupported regression flags, and to a bare fallow --format badge run (before, exit code 1).
  • A script that matches source == "scripts" must also accept a CI file path. This applies to fallow list --entry-points --format json. (#4845)
  • fallow fix --format json no longer emits skip_reason: "line_out_of_range". Match the new catalog skip reasons.
  • Ids of client-server-leak candidates change. The finding_id of each candidate and the stable_finding_id of each direct candidate change. A verdict file from before the upgrade does not match, and a suppression comment must be at the new line. A stored verdict for an old stable_finding_id makes fallow security survivors exit with code 2, so save the candidates and verdicts again and review each direct candidate. (#4881, #4953)
  • fallow security can give new candidates. The new sink call forms give more candidates, and fewer calls show as unresolved callees. (#4940)
  • fallow health --css reports more findings. The --css section now runs the project-wide stylesheet pass and adds the cross-file styling findings. (#4944)
  • effect.schemaExportsAsTypes no longer accepts a reassigned binding as a schema. A let or var binding that the module assigns again is no longer a schema. (#4988)
  • A focused duplication run can report a lower percentage. On a project with 1024 or more files, the totals now cover the full project.
  • Code scanning can show some alerts as new one time. This applies to the duplication results of bare fallow and fallow audit SARIF, and to re-export cycles. (#4873, #4941)
  • A job that sets a workspace and no comment id gets a new sticky comment. The first run after the upgrade posts a new comment and leaves the old comment in place. Delete the old comment, or set comment-id: fallow-results to keep it. (#4845)
  • --fail-on-stale-baseline can fail on a health baseline that passed before. Health JSON identifiers change for plus-addressed emails. A --group filter or a saved health group baseline that names a later spelling of a CODEOWNERS header no longer matches.
  • Path globs can match other files. !packages/* no longer excludes packages/a/b, so write !packages/** to exclude each level. A tsconfig include entry such as src/*.ts no longer matches src/nested/a.ts.
  • A config that an earlier version migrated stays as it is. Set the four migrated rules to error by hand to get the gate of the source config. (#4905)

Full Changelog: v3.45.0...v3.46.0