Skip to content

custom_lint:rules section from "include" is not used #371

@ChaserVasya

Description

@ChaserVasya

Describe the bug

When using include to include an analysis_options.yaml file from a package that has custom_lint rules set to false, those rules are still being enforced in the including project unless they are explicitly re-declared as false in the root analysis_options.yaml.

I have to disable rules in all analysis_options.yaml. It is error-prone work and maintenance

To Reproduce

# packages/shared_lint/lib/analysis_options.yaml
include: package:altive_lints/altive_lints.yaml

analyzer:
  plugins:
    - custom_lint

custom_lint:
  rules:
    - avoid_hardcoded_color: false
# analysis_options.yaml
include: package:shared_lint/analysis_options.yaml
// lib/main.dart
import 'package:flutter/material.dart';

void main() {
  const color = Color(0xFF000000); // This should not trigger avoid_hardcoded_color
}

dart run custom_lint shows warning.

To work around the issue, you need to explicitly re-declare the rule in the root file:

# analysis_options.yaml
include: package:shared_lint/analysis_options.yaml

custom_lint:
  rules:
    - avoid_hardcoded_color: false  # Must duplicate this even though it's already false in included file

Expected behavior

When a custom_lint rule is set to false in an included analysis_options.yaml file, it should be respected in the including project without needing to explicitly re-declare it. The include mechanism should properly merge/override the custom_lint configuration from the included file.

Context

custom_lint 0.7.6

flutter --version

Flutter 3.32.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision fcf2c11572 (5 months ago) • 2025-06-24 11:44:07 -0700
Engine • revision dd93de6fb1 (5 months ago) • 2025-06-24 07:39:37 -0700
Tools • Dart 3.8.1 • DevTools 2.45.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions