fix(config): discover global config from cwd for multi-path runs#660
Merged
Conversation
When several paths are passed to `rumdl check`, the global config was seeded from the first path's directory. If that path lived in a subdirectory whose `.rumdl.toml` `extend-disable`s a rule, that nested config became the global baseline for the whole run, silently disabling the rule for files in other directories that inherit the project-root config. Tools that pass a sorted file list (pre-commit, editor wrappers) hit this whenever the alphabetically-first file sits under such a subdirectory: e.g. `rumdl check .claude/a.md d/b.md` dropped MD013 on `d/b.md` because `.claude/.rumdl.toml` extend-disables it. Discover the global config from the cwd for multi-path runs; per-file grouping still layers each file's own nearest config on top. Single-path runs keep discovering next to the given path.
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.
Summary
rumdl checkwith multiple paths can silently drop findings for files that should be linted. When thepaths span several config scopes, the global config is seeded from the first path's directory. If that
path lives in a subdirectory whose
.rumdl.tomlextend-disables a rule, that nested config becomes theglobal baseline for the whole run — disabling the rule for files in other directories that inherit the
project-root config.
Reproduction
The result depends on argument order. Tools that pass a sorted file list (pre-commit, editor wrappers) hit
this whenever the alphabetically-first file sits under such a subdirectory — e.g. a repo with a root config
plus
.claude/.rumdl.toml/src/.rumdl.tomlthatextend-disablea rule will have that rule disabledrepo-wide on a full-tree
rumdl check, even for files that should keep it. The effect is a false-negativegate (long lines pass), which is how this was found.
Root cause
src/commands/check.rsderivesdiscovery_dirfrom the first path's directory:load_config_with_cli_error_handling_with_dirthenchdirs there and discovers the nearest.rumdl.toml,which becomes
root_config. Inresolution.rs, files outside that subdirectory land in the root group(
effective_config = None) and use this contaminatedroot_config, so a rule the project root enablesends up disabled for them.
Fix
For multi-path runs, discover the global config from the cwd (project root) instead of the first path's
directory. Per-file grouping still layers each file's own nearest config on top, so nested
extend-disablekeeps working for files actually under those directories. Single-path runs keep the existing
"discover next to that path" behavior.
Tests
Added
test_multi_path_global_config_not_seeded_from_first_pathintests/config/config_upward_traversal_test.rs— it fails before this change and passes after. The fullcargo testsuite passes, and the existing single-path config-discovery tests are unchanged.