-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Problem
Currently, it's difficult for developers to determine the final, resolved set of lint rules that are in effect for a given package or directory. The configuration is often spread across multiple analysis_options.yaml
files (via include:
statements), package presets (like package:lints/core.yaml
), and potentially custom lint rules.
Developers cannot easily verify exactly how their options are being parsed, which rules are active, which directories are excluded, or what severity levels are applied.
Use Cases
-
Tooling Integration (LLMs): A primary motivation is to provide a definitive list of active lint rules (and optionally their descriptions) to external tools, such as LLMs. This allows the AI to generate or refactor code that adheres strictly to the project's specific coding standards.
-
Configuration Debugging: Developers (especially plugin authors or those new to a complex codebase) need a way to debug their analysis setup. A command to show the final "computed" configuration would confirm if:
include:
statements are working as expected.- Files/directories are being correctly excluded.
- Custom severities are being applied.
- Experimental features are enabled.
- Custom lint rules are being discovered and applied.
Proposed Solution
Add a new flag to dart analyze
, such as --show-options
or --show-config
.
When run, this command would parse the analysis options for the target directory (just as regular analysis does) but instead of running the analysis, it would print a human-readable summary of the effective configuration.
Example usage:
dart analyze --show-options .
dart analyze --show-options test/
Output:
- A definitive list of all active lint rules (including any discovered custom lint rules).
Optional Output:
Additionally, a secondary flag (e.g., --show-descriptions
) should be added. When present, the output should also include the short (two-ish-line) description for each active lint rule, pulling this information from existing metadata (like that found in pkg/linter/messages.yaml
).