-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Describe the problem
At the moment, custom_lint runs all active plugins globally under the root context.
This means there’s no way to disable or scope a plugin (like riverpod_lint) to only part of the codebase, e.g. lib/** but not test/**.
While it’s possible to add a test/analysis_options.yaml, most IDEs (VS Code, IntelliJ) still merge the root configuration and show diagnostics for plugins that should be disabled.
Excluding test/** at the analyzer level disables all lints and refactorings, which is not practical.
This limitation has been discussed in related issues such as:
- workspace's analysis_options.yaml is ignored #364 — workspace’s
analysis_options.yamlignored - Feature: File-Level Analysis Filtering for CI Optimization #365 — file-level analysis filtering
These clearly show that finer-grained scoping is a recurring need.
Proposed solution
Allow each plugin to define optional include / exclude globs in analysis_options.yaml.
Example:
custom_lint:
plugins:
- riverpod_lint:
include:
- lib/**
exclude:
- test/**
- company_internal_lints:
exclude:
- example/**This would not affect how rules are defined — it simply changes where each plugin runs.
It could be implemented by checking file path filters when building the analysis context roots or when dispatching diagnostics per plugin.
Why this matters
- Reduces noise from lints that don’t make sense in tests or generated files.
- Avoids breaking refactoring/navigation by globally excluding test folders.
- Keeps the project single-root (no need for separate analyzer contexts).
- Makes
custom_lintmore flexible for large monorepos and multi-plugin environments.
Alternatives considered
- Using separate
analysis_options.yamlper folder (not reliable across IDEs). - Rule-level
ignore_test_filesoptions (moves complexity to each package). - Excluding test folders globally (breaks analysis and tooling features).
Additional context
This proposal originated from a discussion in riverpod_lint where the maintainer confirmed that folder-based configuration is not currently possible.
Having a plugin-level include/exclude feature in custom_lint would solve this generically for all lint packages.