Add hierarchical configuration for pony-lint#5135
Merged
SeanTAllen merged 1 commit intomainfrom Apr 5, 2026
Merged
Conversation
a55bc24 to
411062f
Compare
Subdirectory .pony-lint.json files override the root config for their subtree using proximity-first precedence. This lets projects disable rules for specific directories (e.g., turning off package-docstring for examples/) without affecting the rest of the codebase. Addresses: #5028
411062f to
c1d8b44
Compare
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.
pony-lint now supports
.pony-lint.jsonfiles in subdirectories, not just at the project root. A subdirectory config overrides the root config for all files in that subtree, using the same JSON format and proximity-first precedence.New types:
ConfigResolverresolves per-directory rule status by merging the config hierarchy.LintConfig.merge()layers child overrides on parent configs with category-cleaning semantics.Config discovery piggybacks on the existing file-discovery walk alongside
.gitignore/.ignoreloading. Intermediate configs between the hierarchy root and walk targets are pre-loaded, and explicit file targets load their directory's config directly.Malformed subdirectory configs produce
lint/config-errordiagnostics and fall through to the parent config.Design: #5028
Things to note
Uncached RuleRegistry per file in text phase —
_registry_for()constructs a newRuleRegistryfor every file in an overridden directory. The config is cached but the registry is not. Negligible for a CLI tool; easy to add a registry cache later if needed.Walk-discovered configs ignore empty
root_dirsentinel —_FileCollector._load_configruns unconditionally during the walk regardless of whether hierarchical config is enabled (emptyroot_dir). No practical impact sincemain.ponyalways passes a non-emptyroot_dir.