From 2345a8ed3804f0e311e6a2fd151f4dd2d2dcd682 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 1 Jun 2021 16:59:49 -0500 Subject: [PATCH 1/2] Include new rule sets in the machine generated rules file Fixes #2611 --- tool/machine.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tool/machine.dart b/tool/machine.dart index 27ae2dcba..0a6bf605a 100644 --- a/tool/machine.dart +++ b/tool/machine.dart @@ -13,13 +13,14 @@ import 'doc.dart'; /// Generates a list of lint rules in machine format suitable for consumption by /// other tools. -void main(List args) { +void main(List args) async { var parser = ArgParser() ..addFlag('pretty', abbr: 'p', help: 'Pretty-print output.', defaultsTo: true); var options = parser.parse(args); registerLintRules(); + await fetchBadgeInfo(); var json = getMachineListing(Registry.ruleRegistry, pretty: options['pretty'] == true); print(json); @@ -39,8 +40,11 @@ String getMachineListing(Iterable ruleRegistry, 'maturity': rule.maturity.name, 'incompatible': rule.incompatibleRules, 'sets': [ + if (coreRules.contains(rule.name)) 'core', + if (recommendedRules.contains(rule.name)) 'recommended', if (flutterRules.contains(rule.name)) 'flutter', if (pedanticRules.contains(rule.name)) 'pedantic', + if (effectiveDartRules.contains(rule.name)) 'effective_dart', ], 'details': rule.details, } From 281620486d90bdef092ed5fb08e3342c534521ac Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 1 Jun 2021 17:04:07 -0500 Subject: [PATCH 2/2] Add a flag to not include the sets --- tool/machine.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tool/machine.dart b/tool/machine.dart index 0a6bf605a..ffe0a6928 100644 --- a/tool/machine.dart +++ b/tool/machine.dart @@ -16,11 +16,14 @@ import 'doc.dart'; void main(List args) async { var parser = ArgParser() ..addFlag('pretty', - abbr: 'p', help: 'Pretty-print output.', defaultsTo: true); + abbr: 'p', help: 'Pretty-print output.', defaultsTo: true) + ..addFlag('sets', abbr: 's', help: 'Include rule sets', defaultsTo: true); var options = parser.parse(args); registerLintRules(); - await fetchBadgeInfo(); + if (options['sets'] == true) { + await fetchBadgeInfo(); + } var json = getMachineListing(Registry.ruleRegistry, pretty: options['pretty'] == true); print(json);