Skip to content

fix: resolve default rule parameters from included package configurations #317

Description

@solid-illiaaihistov

Problem

After the migration to the new analyzer plugin system, support for resolving inherited configurations (include: package:...) and package-default rule parameters stopped working. As a result, projects could not share lint rule parameters or use shared options.

Solution

Implemented a proper configuration loader and parser that restores support for package-level configurations and rule suppression.

Key Components:

  1. Package URI Resolution:

    • Implemented lib/src/common/parameter_parser/package_config_resolver.dart to find the nearest .dart_tool/package_config.json and resolve package: URIs into absolute file system paths.
  2. Include Processing & Merging:

    • Added lib/src/common/parameter_parser/analysis_options_parser.dart to recursively traverse includes (including package: paths), merge default options, and handle cyclic dependencies.
  3. Rule Application:

    • Wrapped rules in lib/src/models/proxy_analysis_rule.dart and lib/src/models/proxy_multi_analysis_rule.dart to apply merged settings and respect rule suppression.
  4. Testing:

    • Added unit tests in test/src/common/parameter_parser/analysis_options_loader_test.dart to verify package include resolution, parameter merging, and cyclic imports.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions