| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library linter.src.rules; | 5 library linter.src.rules; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:linter/src/config.dart'; | 9 import 'package:linter/src/config.dart'; |
| 10 import 'package:linter/src/linter.dart'; | 10 import 'package:linter/src/linter.dart'; |
| 11 import 'package:linter/src/rules/always_declare_return_types.dart'; | 11 import 'package:linter/src/rules/always_declare_return_types.dart'; |
| 12 import 'package:linter/src/rules/always_specify_types.dart'; | 12 import 'package:linter/src/rules/always_specify_types.dart'; |
| 13 import 'package:linter/src/rules/avoid_as.dart'; |
| 13 import 'package:linter/src/rules/camel_case_types.dart'; | 14 import 'package:linter/src/rules/camel_case_types.dart'; |
| 14 import 'package:linter/src/rules/constant_identifier_names.dart'; | 15 import 'package:linter/src/rules/constant_identifier_names.dart'; |
| 15 import 'package:linter/src/rules/empty_constructor_bodies.dart'; | 16 import 'package:linter/src/rules/empty_constructor_bodies.dart'; |
| 16 import 'package:linter/src/rules/implementation_imports.dart'; | 17 import 'package:linter/src/rules/implementation_imports.dart'; |
| 17 import 'package:linter/src/rules/library_names.dart'; | 18 import 'package:linter/src/rules/library_names.dart'; |
| 18 import 'package:linter/src/rules/library_prefixes.dart'; | 19 import 'package:linter/src/rules/library_prefixes.dart'; |
| 19 import 'package:linter/src/rules/non_constant_identifier_names.dart'; | 20 import 'package:linter/src/rules/non_constant_identifier_names.dart'; |
| 20 import 'package:linter/src/rules/one_member_abstracts.dart'; | 21 import 'package:linter/src/rules/one_member_abstracts.dart'; |
| 21 import 'package:linter/src/rules/package_api_docs.dart'; | 22 import 'package:linter/src/rules/package_api_docs.dart'; |
| 22 import 'package:linter/src/rules/package_prefixed_library_names.dart'; | 23 import 'package:linter/src/rules/package_prefixed_library_names.dart'; |
| 23 import 'package:linter/src/rules/prefer_is_not_empty.dart'; | 24 import 'package:linter/src/rules/prefer_is_not_empty.dart'; |
| 24 import 'package:linter/src/rules/pub/package_names.dart'; | 25 import 'package:linter/src/rules/pub/package_names.dart'; |
| 25 import 'package:linter/src/rules/slash_for_doc_comments.dart'; | 26 import 'package:linter/src/rules/slash_for_doc_comments.dart'; |
| 26 import 'package:linter/src/rules/super_goes_last.dart'; | 27 import 'package:linter/src/rules/super_goes_last.dart'; |
| 27 import 'package:linter/src/rules/type_annotate_public_apis.dart'; | 28 import 'package:linter/src/rules/type_annotate_public_apis.dart'; |
| 28 import 'package:linter/src/rules/type_init_formals.dart'; | 29 import 'package:linter/src/rules/type_init_formals.dart'; |
| 29 import 'package:linter/src/rules/unnecessary_brace_in_string_interp.dart'; | 30 import 'package:linter/src/rules/unnecessary_brace_in_string_interp.dart'; |
| 30 import 'package:linter/src/rules/unnecessary_getters_setters.dart'; | 31 import 'package:linter/src/rules/unnecessary_getters_setters.dart'; |
| 31 | 32 |
| 32 final Registry ruleRegistry = new Registry() | 33 final Registry ruleRegistry = new Registry() |
| 33 ..register(new AlwaysDeclareReturnTypes()) | 34 ..register(new AlwaysDeclareReturnTypes()) |
| 34 ..register(new AlwaysSpecifyTypes()) | 35 ..register(new AlwaysSpecifyTypes()) |
| 36 ..register(new AvoidAs()) |
| 35 ..register(new CamelCaseTypes()) | 37 ..register(new CamelCaseTypes()) |
| 36 ..register(new ConstantIdentifierNames()) | 38 ..register(new ConstantIdentifierNames()) |
| 37 ..register(new EmptyConstructorBodies()) | 39 ..register(new EmptyConstructorBodies()) |
| 38 ..register(new ImplementationImports()) | 40 ..register(new ImplementationImports()) |
| 39 ..register(new LibraryNames()) | 41 ..register(new LibraryNames()) |
| 40 ..register(new LibraryPrefixes()) | 42 ..register(new LibraryPrefixes()) |
| 41 ..register(new NonConstantIdentifierNames()) | 43 ..register(new NonConstantIdentifierNames()) |
| 42 ..register(new PreferIsNotEmpty()) | 44 ..register(new PreferIsNotEmpty()) |
| 43 ..register(new OneMemberAbstracts()) | 45 ..register(new OneMemberAbstracts()) |
| 44 ..register(new PackageApiDocs()) | 46 ..register(new PackageApiDocs()) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 /// enables `my_rule`. | 74 /// enables `my_rule`. |
| 73 /// | 75 /// |
| 74 /// Unspecified rules are treated as disabled by default. | 76 /// Unspecified rules are treated as disabled by default. |
| 75 Iterable<LintRule> enabled(LintConfig config) => rules | 77 Iterable<LintRule> enabled(LintConfig config) => rules |
| 76 .where((rule) => config.ruleConfigs.any((rc) => rc.enables(rule.name))); | 78 .where((rule) => config.ruleConfigs.any((rc) => rc.enables(rule.name))); |
| 77 | 79 |
| 78 void register(LintRule rule) { | 80 void register(LintRule rule) { |
| 79 _ruleMap[rule.name] = rule; | 81 _ruleMap[rule.name] = rule; |
| 80 } | 82 } |
| 81 } | 83 } |
| OLD | NEW |