Skip to content

Commit

Permalink
de-linting (keeping ahead of the Joneses) (dart-lang#1823)
Browse files Browse the repository at this point in the history
* linting

* linting
  • Loading branch information
pq authored Nov 6, 2019
1 parent 6b264ac commit 0b18afa
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
6 changes: 4 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ linter:
# - prefer_generic_function_type_aliases # under review (see #1068)
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_interpolation_to_compose_strings
- prefer_interpolation_to_compose_strings
# - prefer_iterable_whereType (included in pedantic)
# - prefer_mixin
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
Expand All @@ -114,7 +115,8 @@ linter:
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_this
- use_function_type_syntax_for_parameters
- use_setters_to_change_properties
- use_string_buffers
- use_to_and_as_if_applicable
# - void_checks # under review (see #1068)
- void_checks # under review (see #1068)
2 changes: 1 addition & 1 deletion lib/src/rules/control_flow_in_finally.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ abstract class ControlFlowInFinallyBlockReporterMixin {

AstNode _findEnablerNode(
AstNode ancestor,
bool finallyBlockAncestorPredicate(AstNode n),
bool Function(AstNode n) finallyBlockAncestorPredicate,
AstNode node,
TryStatement tryStatement) {
AstNode enablerNode;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/rules/invariant_booleans.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class _ContradictionReportRule extends LintRule {
_ContradictionReportRule(ContradictoryComparisons comparisons)
: super(
name: 'invariant_booleans',
description: _desc + ' verify: ${comparisons.first}.',
description: '$_desc verify: ${comparisons.first}.',
details: _details,
group: Group.errors);
}
Expand Down
4 changes: 1 addition & 3 deletions lib/src/rules/overridden_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ class _Visitor extends SimpleAstVisitor<void> {
}
InterfaceType interface =
interfaces.firstWhere(containsOverriddenMember, orElse: () => null);
return interface == null
? null
: interface.accessors.firstWhere(isOverriddenMember);
return interface?.accessors?.firstWhere(isOverriddenMember);
}
}
3 changes: 2 additions & 1 deletion test/engine_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ main() {
void defineLinterEngineTests() {
group('engine', () {
group('reporter', () {
_test(String label, String expected, report(PrintingReporter r)) {
_test(
String label, String expected, Function(PrintingReporter r) report) {
test(label, () {
String msg;
PrintingReporter reporter = PrintingReporter((m) => msg = m);
Expand Down
2 changes: 1 addition & 1 deletion test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ defineTests() {

Map<String, YamlNode> options = _getOptionsFromString(src);
var configuredLints =
((options['linter'] as YamlMap)['rules'] as YamlList);
(options['linter'] as YamlMap)['rules'] as YamlList;

// rules are sorted
expect(
Expand Down
2 changes: 1 addition & 1 deletion test/util/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import 'package:matcher/matcher.dart';
import 'package:test/test.dart';

void testEach<T>(Iterable<T> values, bool f(T s), Matcher m) {
void testEach<T>(Iterable<T> values, bool Function(T s) f, Matcher m) {
values.forEach((s) => test('"$s"', () => expect(f(s), m)));
}
4 changes: 2 additions & 2 deletions tool/scorecard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class ScoreCard {
scores.add(score);
}

void forEach(void f(LintScore element)) {
void forEach(void Function(LintScore element) f) {
scores.forEach(f);
}

Expand Down Expand Up @@ -273,7 +273,7 @@ class ScoreCard {
return scorecard;
}

void removeWhere(bool test(LintScore element)) {
void removeWhere(bool Function(LintScore element) test) {
scores.removeWhere(test);
}
}
Expand Down

0 comments on commit 0b18afa

Please sign in to comment.