Repository navigation
v3.46.0: fallow explain code examples, threshold override comments, includeEntryExports through export *, health --css broken references
·
154 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Features
- A
fallow-override-threshold-next-linecomment 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 ofhealth.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 optionalinline_threshold_overridesarray. A comment with a problem, for example a missing reason, has no effect and goes to the new optionalinline_threshold_override_problemsarray. A finding that a comment ceiling applies to hasoverride_comment_line, and the human report showsoverride (comment, line N)oroverride (config). To turn the comment form off, sethealth.inlineThresholdOverrides(defaulttrue) tofalse.fallow auditreports a new comment through theadded-suppressionrule. Thanks @DiefBell for the request. (#4898) fallow explainshows 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 offallow auditshows the files before and after the change.--format jsonandfallow schema --cli-referencehave the files in the newexample_filesandexample_base_filesarrays. 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 --cssreportscss-broken-reference. The--csssection now runs the project-wide stylesheet pass. Health then reports ananimationthat names a@keyframesrule 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 --cssscans every stylesheet and reports only the findings in the changed files. The MCPcheck_healthtool does the same whencssis true. (#4944)fallow securityreports the usual forms of a sink call. Calls such asnew Handlebars.SafeString(x),this.sanitizer.bypassSecurityTrustHtml(x),$("#p").html(x)andconsole.log("login", secret)now give a candidate. A sink behindthis., a call result or a local alias gets the same candidate as the plain form. Matcher rows now state theirformsandarguments. A call of a member ofthisitself, such asthis.query(x), matches only the rows that set the newthis_receiverfield. Fallow also reads the callees behindthis.and call results for security controls and framework request sources. For example,this.router.get("/", handler)now marksreqas request input. (#4940)- New uses that
fallow dead-codereads. Acoderabbitplugin keeps.coderabbit.config.tsin use when the project depends on@coderabbitai/config. Agnome-shell-extensionplugin makesextension.jsandprefs.jsentry points in each folder whosemetadata.jsonhas theuuidandshell-versionkeys. Fallow reads the lifecycle commands of development container files, such as.devcontainer/devcontainer.json, and thescripts[].commandvalues of at3.jsonfile as package.json scripts. A file that code names with a path below the module directory, such aspath.join(__dirname, "../scripts/agent.mjs"), is no longer an unused file. Fallow also reads the script files of a process call whosecwdoption 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
ignoreExportshint for each group of 3 findings or more. In JSON, each such finding has anadd-to-configaction. An unused export or unused type in a generated file hasauto_fixable: falseon itsremove-exportaction. It has nosuppress-lineaction, because the generator writes the file again. (#4912) fallow schematells source edits apart from report writes. Eachmcp_toolsandfallow://toolsrow has a newmodifies_sourcefield, which istrueonly forfix_apply. Theread_onlyfield and the MCPreadOnlyHintannotation do not change. Infallow schemaandfallow schema --cli-reference, each deprecated command and option now has adeprecatedobject with thereplacement. (#4845)
Changed
- The docs link of each issue type opens its rule page.
fallow explain,--explain, the SARIFhelpUri, the LSP, the MCPfallow://issue-typesresource,fallow schema, the human report and the GitHub summary now link tohttps://fallow.tools/docs/rules/<id>/. The old links still work. (#4894) - The
fallow dead-codeoptions for the architecture issue types are deprecated.--circular-deps,--re-export-cycles,--package-cycles,--boundary-violationsand--policy-violationsprint one stderr warning each with thefallow architectureoption to use.--quietremoves the warning. The next major version removes these options. - A config with
minimumVersion3.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
errorto fail on it." Machine formats and--quietruns do not change. (#4905) - An entry point from a CI file now names that CI file as its source.
fallow list --entry-pointsprintstools/release.ts (.github/workflows/ci.yml)instead oftools/release.ts (scripts), and the JSONsourcefield changes the same way. Entry points frompackage.jsonscripts keep their label. (#4845) - The built-in ignore list now has the root
fallow-viz.html. Fallow no longer analyzes the map thatfallow vizwrites. To analyze the file again, add"!fallow-viz.html"toignorePatterns. (#4845) fallow fix --format jsonhas new skip reasons for catalog records. It emitsnot_found,not_empty,unsupported_yaml_styleandunsafe_edit, and no longer emitsline_out_of_range. An edit that would change other parts ofpnpm-workspace.yamlis now a skip withunsafe_edit, not a write error with exit code 2.fallow fixedits 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 theirexportkeywords, and the finding stays in the report. This rule does not apply to export lists such asexport { 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-runlists an unused exported enum with only unused members one time.fallow auditreads 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.
ConfigLoadOptionsandConfigFileOptionshave the time limit of a remoteextendsfetch, are#[non_exhaustive]and havenewconstructors. FourResolvedConfigmutators are#[doc(hidden)]. Session loaders without a resolved run need thetestingfeature. Some project config helpers,cache_dir_env_overrideandProductionEnv::from_processare removed. Open a session withfallow_api::run::resolve_run, thenRunnable::open_sessionorEditorAnalysisSession::open.
Bug fixes
includeEntryExportsnow checks the names that an entry file re-exports withexport *. Anexport *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)includeEntryExportsnow checks the enum, class and namespace members of an export that an entry file declares.publicPackagesnow also removes the unused-namespace-member findings of the public exports of a package. See the upgrade notes. (#4990)publicPackagesno 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 newnow fails when a change adds a secret read or a server-only import below line 1 of an existing client module. Aclient-server-leakcandidate now points at that read or import, and asecret-sourcetrace hop has a newsecret_readsarray. (#4881)- The
stable_finding_idof a directclient-server-leakcandidate 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
loaderno longer gives a candidate in the computed or the destructured form. Fallow checksprocess.env['X']andconst { X } = process.envthe same asprocess.env.X. (#4882) - A React Router
.serversink gets React Router advice. TheNext:step tells you to move the call intoloader,action,middlewareorheaders, or to move the code that the client needs out of the.servermodule. Thanks @cr101 for the report. (#4954) fallow security --runtime-coverageuses the settings of its own run for the runtime coverage step. A value such asFALLOW_CACHE_DIRnow reaches that step. (#4875)fallow dead-codeno longer reportsreactas unused when the automatic JSX runtime uses it. Fallow creditsreactfor a JSX file without a runtime pragma below a tsconfig withjsxset toreact-jsxorreact-jsxdevand nojsxImportSource. Fallow also creditsreactfor 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 marksbaseandroundedas used. (#4844) fallow dead-codeno 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 defaultand property reads. Withprivate-type-leakson, 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]()withactionof 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 aduplicate-exportsgroup 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 thepack.entryof Vite+ and thebuild.lib.entryof Vite. (#4912) - A CI step that puts a
node_modules/.binpath in a shell variable now credits the package. The assignmentbundler=scripts/node_modules/.bin/esbuildcounts 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.jsin use and credits installed font packages andexpo-module.config.jsonmodules that the app declares. (#4912) effect.schemaExportsAsTypesaccepts a schema that a function call builds.export const User = makeUser()is a schema when eachreturnofmakeUseris a schema. Areturncan call a second such function, to a depth of 4 functions. Aletorvarbinding 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 getssource-parse-degraded, so the findings of the run no longer get theincomplete-import-graphcaveat. (#4828) fallow auditno longer reports an old unused export behind a SvelteKit path alias as introduced. The base snapshot now has.svelte-kit/tsconfig.jsonand thenode_modulesof each workspace package. (#4790)fallow auditno longer passes silently in a shallow clone without a base. It prints a warning on stderr, also under--quiet. The warning namesfetch-depth: 0and--base <ref>. The JSON output reportsgate_outcomes["audit-verdict"].statusasskipped, and the exit code stays 0. (#4839)fallow auditno 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 newand the review comments now find such a file. The change anchors offallow audit --brieffor 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 --briefcompares a movedpackage.jsonwith its old path, and the--diff-filewarning for a diff without added lines names the findings that stay. - A diff scope and
--workspacenarrow 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 barefallowrun 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
warningssentence 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 withoutenforcedorstatusget the same treatment on both. (#4874) - The SARIF of a bare
fallowrun and offallow audithas a location per clone. The duplication run now has the shape offallow dupes --format sarif, with a declaredfallow/code-duplicationrule. (#4873) - A
re-export-cyclefinding has the line of the re-export that closes the cycle. JSON addslineandcol, SARIF adds aregion, and CodeClimate,github-annotationsand the review comments use the line. (#4941) - The CLI reference names
fallow architecturefor the architecture issue types. The cycle, boundary and policy rows now givecommand: "architecture", and the newdeprecated_filter_flagfield 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
kindproperty, andfallow schemamarksunused-catalog-entryas suppressible. (#4846) --sarif-fileexits 2 on a command that writes no SARIF file. To get SARIF fromfallow audit, use--format sarifwith--output-file. (#4845)fallow dupesand 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 forfallow dupesandfallow healthit also names--baseline. (#4931)- A bare
fallow --format badgerun prints one error and exits with code 2.fallow --only health --score --format badgestill renders the badge. (#4845) - Small CLI output fixes.
fallow trace --pathwith no route prints "No import path." once, and the schema commands exit cleanly on a closed pipe.--quiethides two more warnings, andfallow fixlists its entries in path order.fallow flagsno longer reportsboundaries-not-configuredandrule-packs-not-configured.fallow inspectprintskey: valuefields,fallow impact statusprints a short view, andfallow list --boundariesshows therootof a zone. (#4845) - A report or baseline path in
/tmpworks on macOS. Each Unix now allows/tmpfor 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. AnautoDiscoverzone forapp/[id]matches onlyapp/[id]. A negated workspace pattern and a tsconfigincludeorexcludeentry keep*inside one folder level. Recursive workspace patterns work in a checkout path with[,*or?. The Convexfunctionsfolder, the Wranglermainfile and the Mintlify docs folder are literal paths. --workspace '!<nested>'excludes a workspace below a selected workspace. A nested workspace that noworkspaces.settingskey 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-stylepackagesandoverridesnow count. fallow fixand the editor quick fix editpnpm-workspace.yamlsafely.fallow fixno 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 fixno longer breaks an export. It keepsexport default function () {},export default class {}andexport * as ns from './x'as they are. It removes theexportof the right declaration on a shared line. When an earlier edit removed lines, it puts each later edit on the right line. Forexport /* values */ const live = 1, dead = 2;, it reportsdeadwithskip_reason: "shared_declaration_in_use".fallow fixno longer breaks an enum or changes the value of a kept member.Low, Medium, HighwithLowunused becomesMedium = 1, High. When the old value is not a known integer,fallow fixkeeps the whole enum as it is. (#4963)fallow fixno longer edits a generated file. It reports such a file asskippedwithskip_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
suggestionblock 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
latestwhenFALLOW_COMMENT,FALLOW_REVIEWorFALLOW_MUTATIONis 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, notsafe_to_delete. (#4843) fallow health --coveragereads more V8 dumps. It decodes escaped source paths and skips only a malformedsource-map-cacheentry. 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 --hotspotsgives the same churn from the cache as from a--no-cacherun. Two roots that share oneFALLOW_CACHE_DIRno longer read the churn of each other.- Ownership identifies each person correctly. It follows
.mailmap,health.ownership.botPatternsmatches 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 theanonymizedmode 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 prunekeeps the slot of an unnamed function that covers a named function. Thebaseline_stalenesscounts agree with the findings that the baseline hides. --group-by sectionmerges 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-baselinekeeps the other settings of a JSON config. A config that does not parse now stops the save with an error and exit code 2. Thefallow.tomlsave also writesanalysisIdentityand the boundary, policy and cycle counts.- Fallow keeps files that it cannot use.
fallow flags --retirementandfallow list --entry-weightstop with exit code 2 before they replace an unusable regression baseline, andfallow dead-codewarns.fallow audit --walkthrough --mark-viewedkeeps an unreadable ledger, andfallow cloud loginandlogoutkeep a newer credentials file.fallow initappends.fallow/to a.gitignorethat is not UTF-8. fallow reportno longer erases the saved report when--output-filenames the--fromfile. It exits 2 before it opens anything.fallow coverage setupno longer overwrites a coverage recipe that it did not write. The final step says what it did withdocs/collect-coverage.md.fallow agent installkeeps the other MCP servers in an inlinemcp_serverstable.fallow agent statusnames an MCP settings file that does not parse.fallow impactcommands handle their store safely. A failed save exits 2, a reset stays reset, and a damaged store is not overwritten.fallow impact --allcounts a store from a newer fallow as unreadable.fallow migratekeeps the gate of the source config. The migrated config setsunused-dev-dependencies,unused-namespace-members,unlisted-binariesandduplicate-export-aliasestoerror, unless the source config says otherwise. (#4905)fallow migrateandfallow init --tomlwrite configs that load. A severity such as"Warning"becomeswarn. An unknown value gives a warning, and fallow does not migrate that rule. A line break in a source path stays inside theMigrated fromcomment.fallow migrate --tomlnow writes each migrated setting, andfallow init --tomlescapes 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 --performanceputs the config load and the workspace discovery in theconfigspan.workspacesis now a child ofconfig.- 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.allowRemoteExtendsor the workspace picker. fallow vizpanels 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 fourfallow explainexamples. (#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_sizecounted only added lines, so a diff that renames a file gave0.scope_sizenow also counts each touched file that adds no line. It is0only when the diff touches no file and adds no line. (#4974)
Upgrade notes
includeEntryExportscan 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 inpublicPackages, put/** @public */on the declaration, or add anignoreExportsrule for the source file. AnignoreExportsrule for the entry file with"exports": ["*"]credits each name behind itsexport *lines. To keep a member, add a use, list the package inpublicPackages, or add// fallow-ignore-next-linewith the rule name.fallow fixremoves theexportkeyword of a reported name, so check that no code outside the project imports it. (#4986, #4990)publicPackagescan 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-codearchitecture options. Use thefallow architectureoption that the warning names. - Some flag combinations now exit with code 2. This applies to
--sarif-fileon a command that writes no SARIF, to unsupported regression flags, and to a barefallow --format badgerun (before, exit code 1). - A script that matches
source == "scripts"must also accept a CI file path. This applies tofallow list --entry-points --format json. (#4845) fallow fix --format jsonno longer emitsskip_reason: "line_out_of_range". Match the new catalog skip reasons.- Ids of
client-server-leakcandidates change. Thefinding_idof each candidate and thestable_finding_idof 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 oldstable_finding_idmakesfallow security survivorsexit with code 2, so save the candidates and verdicts again and review each direct candidate. (#4881, #4953) fallow securitycan give new candidates. The new sink call forms give more candidates, and fewer calls show as unresolved callees. (#4940)fallow health --cssreports more findings. The--csssection now runs the project-wide stylesheet pass and adds the cross-file styling findings. (#4944)effect.schemaExportsAsTypesno longer accepts a reassigned binding as a schema. Aletorvarbinding 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
fallowandfallow auditSARIF, 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-resultsto keep it. (#4845) --fail-on-stale-baselinecan fail on a health baseline that passed before. Health JSON identifiers change for plus-addressed emails. A--groupfilter 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 excludespackages/a/b, so write!packages/**to exclude each level. A tsconfigincludeentry such assrc/*.tsno longer matchessrc/nested/a.ts. - A config that an earlier version migrated stays as it is. Set the four migrated rules to
errorby hand to get the gate of the source config. (#4905)
Full Changelog: v3.45.0...v3.46.0