Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

fix: correctly available check rule names #1068

Merged
merged 2 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

* fix: correctly available check rule names.

## 5.0.0

* feat: **Breaking change** rename `member-ordering-extended` to `member-ordering`, discarding the old implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'lint_analysis_config.dart';
import 'models/issue.dart';
import 'models/lint_file_report.dart';
import 'models/severity.dart';
import 'rules/rules_factory.dart';

class LintAnalysisOptionsValidator {
static LintFileReport? validateOptions(
Expand All @@ -28,11 +29,11 @@ class LintAnalysisOptionsValidator {
return null;
}

final parsedRuleIds = config.codeRules.map((rule) => rule.id).toList();
final ids = allRuleIds.toSet();
final issues = <Issue>[];

for (final rule in rulesList) {
if (!parsedRuleIds.contains(rule.ruleName)) {
if (!ids.contains(rule.ruleName)) {
issues.add(
Issue(
ruleId: 'unknown-config',
Expand Down
2 changes: 2 additions & 0 deletions lib/src/analyzers/lint_analyzer/rules/rules_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ final _implementedRules = <String, Rule Function(Map<String, Object>)>{
TagNameRule.ruleId: TagNameRule.new,
};

Iterable<String> get allRuleIds => _implementedRules.keys;

Iterable<Rule> get allRules =>
_implementedRules.keys.map((id) => _implementedRules[id]!({}));

Expand Down