Skip to content

Commit 01dab58

Browse files
authored
Add 10 more lint rules (#2352)
1 parent 9acb9b6 commit 01dab58

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

analysis_options.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,25 @@ analyzer:
1717
linter:
1818
rules:
1919
- always_declare_return_types
20+
- avoid_single_cascade_in_expression_statements
21+
- avoid_unused_constructor_parameters
2022
- annotate_overrides
2123
- avoid_init_to_null
2224
- avoid_types_as_parameter_names
25+
- camel_case_types
2326
- directives_ordering
27+
- iterable_contains_unrelated_type
28+
- list_remove_unrelated_type
2429
- no_adjacent_strings_in_list
2530
- package_api_docs
2631
- prefer_final_fields
2732
- prefer_generic_function_type_aliases
33+
- prefer_initializing_formals
34+
- prefer_void_to_null
35+
- provide_deprecation_message
2836
- slash_for_doc_comments
2937
- type_annotate_public_apis
3038
- unawaited_futures
31-
# - unnecessary_brace_in_string_interps
39+
# - unnecessary_brace_in_string_interps
40+
- unnecessary_overrides
41+
- void_checks

lib/src/dartdoc_options.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,7 @@ class _OptionValueWithContext<T> {
454454
///
455455
/// [path] is the path where this value came from (not required to be
456456
/// canonical).
457-
_OptionValueWithContext(this.value, String path, {String definingFile}) {
458-
this.definingFile = definingFile;
457+
_OptionValueWithContext(this.value, String path, {this.definingFile}) {
459458
canonicalDirectoryPath = p.canonicalize(path);
460459
pathContext = p.Context(current: canonicalDirectoryPath);
461460
}
@@ -690,8 +689,7 @@ abstract class DartdocOption<T> {
690689
void _onAdd() {}
691690

692691
/// Adds a list of dartdoc options to the children of this DartdocOption.
693-
void addAll(Iterable<DartdocOption<Object>> options) =>
694-
options.forEach((o) => add(o));
692+
void addAll(Iterable<DartdocOption<Object>> options) => options.forEach(add);
695693

696694
/// Get the immediate child of this node named [name].
697695
DartdocOption<dynamic> operator [](String name) {
@@ -856,7 +854,7 @@ typedef OptionGenerator = Future<List<DartdocOption<Object>>> Function(
856854

857855
/// A [DartdocOption] that only contains other [DartdocOption]s and is not an
858856
/// option itself.
859-
class DartdocOptionSet extends DartdocOption<Null> {
857+
class DartdocOptionSet extends DartdocOption<void> {
860858
DartdocOptionSet(String name, ResourceProvider resourceProvider)
861859
: super(name, null, null, false, false, false, null, resourceProvider);
862860

@@ -880,7 +878,7 @@ class DartdocOptionSet extends DartdocOption<Null> {
880878

881879
/// [DartdocOptionSet] always has the null value.
882880
@override
883-
Null valueAt(Folder dir) => null;
881+
void valueAt(Folder dir) => null;
884882

885883
/// Since we have no value, [_onMissing] does nothing.
886884
@override

lib/src/model/accessor.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ class Accessor extends ModelElement implements EnclosedElement {
3939
return _sourceCode;
4040
}
4141

42-
@override
43-
List<ModelElement> get computeDocumentationFrom {
44-
return super.computeDocumentationFrom;
45-
}
46-
4742
@override
4843
String computeDocumentationComment() {
4944
if (isSynthetic) {

test/dartdoc_options_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,10 @@ void main() {
178178
secondDir = resourceProvider
179179
.getFolder(resourceProvider.pathContext.join(tempDir.path, 'secondDir'))
180180
..create();
181-
resourceProvider.getFile(
182-
resourceProvider.pathContext.join(secondDir.path, 'existing.dart'))
183-
..writeAsStringSync('');
181+
resourceProvider
182+
.getFile(
183+
resourceProvider.pathContext.join(secondDir.path, 'existing.dart'))
184+
.writeAsStringSync('');
184185

185186
secondDirFirstSub = resourceProvider.getFolder(
186187
resourceProvider.pathContext.join(secondDir.path, 'firstSub'))

tool/grind.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void updateThirdParty() async {
205205
for (var patchFileName in Directory(_pkgDir.path)
206206
.listSync()
207207
.map((e) => path.basename(e.path))
208-
.where((String filename) => _mustache4dartPatches.hasMatch(filename))
208+
.where(_mustache4dartPatches.hasMatch)
209209
.toList()
210210
..sort()) {
211211
run('patch',

0 commit comments

Comments
 (0)