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

Commit

Permalink
fix: correctly available check rule names (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
incendial authored Nov 2, 2022
1 parent b8285c7 commit 8bc1a3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit 8bc1a3c

Please sign in to comment.