feat: --no-fail-public — report unused public declarations without failing the build#23
Draft
claude[bot] wants to merge 2 commits into
Draft
feat: --no-fail-public — report unused public declarations without failing the build#23claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012RMbmsRmDqx5eWXFa8R82V
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012RMbmsRmDqx5eWXFa8R82V
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Łukasz Komoszyński · Slack thread
Before
--set-exit-if-changedfails the build on any unused declaration. The only way to avoid failing on public API — which is legitimately "unused" from a library or workspace package's own perspective — is--no-public, which hides those findings entirely. You could either see the public findings or gate CI on private ones, never both in a single run.After
--no-fail-publickeeps public findings in the report but excludes them from the exit code, so CI can surface unused public API as advisory while still failing only on unused private declarations. The default is unchanged (--fail-publicon):--set-exit-if-changedstill fails on anything unless you opt out.Why
Requested for leancode_flutter_template's CI (leancode_flutter_template#730), where the workspace has intentional-but-unused public API for downstream generated apps. This lets one
ciachrun both report everything and gate on private only, instead of choosing between the two.How
--fail-public(defaulttrue) inlib/src/cli/args.dart, next to the--publicgroup.bin/ciach.dart, the exit-code decision now computes a failing subset ofresult.unused; when--fail-publicis off it excludes public findings using ciach's existing public/private determination (UnusedDeclaration.isPrivate, i.e.isPrivateName— the same rule--no-publicuses to filter), returning1iff the subset is non-empty.--no-public(public already filtered out)--no-fail-publicis a no-op.test/cli_exit_code_test.dart) driving the real binary against thesample_pkgfixture, asserting exit0for public-only +--no-fail-public, exit1when a private finding is present, and exit1for--set-exit-if-changedalone.Generated by Claude Code