Skip to content

config: anchor ignore patterns to the config file's directory - #418

Merged
MaximeGaudin merged 2 commits into
mainfrom
fix/issue-25-ignore-anchoring
Aug 29, 2026
Merged

MaximeGaudin merged 2 commits into
mainfrom
fix/issue-25-ignore-anchoring

Conversation

@MaximeGaudin

Copy link
Copy Markdown
Owner

Summary

ignore = ["fixtures/**"] read like a .gitignore entry but was matched as typed, so it named "fixtures wherever the invocation's paths happen to lead" — which in practice meant nothing was ever ignored unless the pattern was spelled **/fixtures/** (#25).

Every pattern is now anchored to the directory of the file that named it, in the Ignore{excluded, excepted} design that landed with #327:

  • A pattern containing / is a path from that directory: fixtures/** is the fixtures folder beside slint.toml, however the run was invoked, and a leading / says the same thing again. A trailing /** excludes the named directory itself, the way git stops at the folder.
  • A pattern with no / is a name, and matches at any depth below the anchor (the .gitignore convention).
  • ! negation keeps winning over the plain patterns in whatever order they were written, anchored to the same directory.
  • The user-global config (fix: say which config file wins when a directory holds several #323) is a config file like any other: its patterns speak for its own directory, so a personal ignore cannot reach into the projects being linted.
  • --ignore-path files are anchored to their own directory too, so slint --ignore-path tools/my-ignores speaks for tools/, not for the tree above it.

This supersedes the intent of #325 (which was mutually exclusive with #327 as submitted) folded into the new design. Matching runs against both the paths as walked and their resolved form, so relative, dotted, and symlinked invocations of the same run behave identically.

Fixes #25

Test plan

  • New regression tests failed before the fix and pass after: config-anchored fixtures/** and /fixtures/** (including a dotted invocation path), bare-name at any depth, subdirectory config that must not leak above itself, user-global config anchored to its own directory, !-negation interplay with anchoring, and --ignore-path anchored to the ignore file's directory (unit tests in packages/core/src/skill.rs and packages/core/src/engine.rs, end-to-end in apps/cli/tests/cli.rs)
  • Existing !-negation and ignore tests pass unchanged
  • Local checks mirror CI and passed before push (cargo test -p slint -p slint-cli, then ./scripts/check.sh --no-js)
  • CI green on the PR

…file

Anchored, bare-name, leading-slash, negated, user-global-config,
subdirectory-config and --ignore-path cases, all red before the fix.
Patterns in `ignore` used to be matched as typed, so `fixtures/**` read
like a .gitignore entry and matched nothing. Every pattern is now
anchored to the directory of the file that named it: a pattern with a
`/` is a path from there, a bare name matches at any depth below it,
and a trailing `/**` excludes the named directory itself. `!` negation
keeps winning over the plain patterns, anchored to the same directory.

This makes the user-global config speak for its own tree and gives
--ignore-path files the same rule — patterns in one are relative to
that file's own directory — which supersedes the intent of #325 folded
into #327's Ignore design.

Fixes #25
@MaximeGaudin
MaximeGaudin merged commit 5024229 into main Aug 29, 2026
8 checks passed
@MaximeGaudin
MaximeGaudin deleted the fix/issue-25-ignore-anchoring branch August 29, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config: ignore glob patterns are not anchored to the config file's directory, unlike .gitignore and unlike this project's own plugin paths

1 participant