Skip to content

Commit 88be032

Browse files
committed
lots of lints
1 parent 191b538 commit 88be032

35 files changed

+114
-50
lines changed

.analysis_options

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
11
analyzer:
22
strong-mode: true
3+
linter:
4+
rules:
5+
- always_declare_return_types
6+
- annotate_overrides
7+
- avoid_empty_else
8+
- avoid_init_to_null
9+
- avoid_return_types_on_setters
10+
- camel_case_types
11+
# - constant_identifier_names # https://github.com/dart-lang/build/issues/94
12+
- empty_constructor_bodies
13+
- hash_and_equals
14+
- library_names
15+
- library_prefixes
16+
- non_constant_identifier_names
17+
- package_api_docs
18+
- package_names
19+
- package_prefixed_library_names
20+
- prefer_is_not_empty
21+
- slash_for_doc_comments
22+
- sort_unnamed_constructors_first
23+
- super_goes_last
24+
- type_annotate_public_apis
25+
- type_init_formals
26+
- unnecessary_brace_in_string_interp
27+
- unnecessary_getters_setters

lib/src/asset/asset.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ class Asset {
1313

1414
Asset(this.id, this.stringContents);
1515

16+
@override
1617
String toString() => 'Asset: $id';
1718
}

lib/src/asset/file_based.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import 'exceptions.dart';
2020
/// files from disk.
2121
class FileBasedAssetReader implements AssetReader {
2222
final PackageGraph packageGraph;
23-
final ignoredDirs;
23+
final List<String> ignoredDirs;
2424

2525
FileBasedAssetReader(this.packageGraph,
2626
{this.ignoredDirs: const ['build', 'packages', '.pub']});
@@ -40,6 +40,7 @@ class FileBasedAssetReader implements AssetReader {
4040
}
4141

4242
/// Searches for all [AssetId]s matching [inputSet]s.
43+
@override
4344
Stream<AssetId> listAssetIds(Iterable<InputSet> inputSets) async* {
4445
var seenAssets = new Set<AssetId>();
4546
for (var inputSet in inputSets) {
@@ -57,6 +58,7 @@ class FileBasedAssetReader implements AssetReader {
5758
}
5859
}
5960

61+
@override
6062
Future<DateTime> lastModified(AssetId id) async {
6163
var file = await _fileFor(id, packageGraph);
6264
if (!await file.exists()) {
@@ -92,7 +94,7 @@ class FileBasedAssetWriter implements AssetWriter {
9294
}
9395

9496
@override
95-
delete(AssetId id) async {
97+
Future delete(AssetId id) async {
9698
assert(id.package == packageGraph.root.name);
9799

98100
var file = _fileFor(id, packageGraph);

lib/src/asset/id.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,14 @@ class AssetId implements Comparable<AssetId> {
6565
path = data[1];
6666

6767
/// Returns `true` of [other] is an [AssetId] with the same package and path.
68-
operator ==(other) =>
68+
@override
69+
bool operator ==(Object other) =>
6970
other is AssetId && package == other.package && path == other.path;
7071

72+
@override
7173
int get hashCode => package.hashCode ^ path.hashCode;
7274

75+
@override
7376
int compareTo(AssetId other) {
7477
var packageComp = package.compareTo(other.package);
7578
if (packageComp != 0) return packageComp;
@@ -86,11 +89,12 @@ class AssetId implements Comparable<AssetId> {
8689
AssetId changeExtension(String newExtension) =>
8790
new AssetId(package, pathos.withoutExtension(path) + newExtension);
8891

92+
@override
8993
String toString() => "$package|$path";
9094

9195
/// Serializes this [AssetId] to an object that can be sent across isolates
9296
/// and passed to [deserialize].
93-
serialize() => [package, path];
97+
Object serialize() => [package, path];
9498
}
9599

96100
String _normalizePath(String path) {

lib/src/asset_graph/graph.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ class AssetGraph {
7777
Iterable<AssetNode> get allNodes => _nodesById.values;
7878

7979
@override
80-
toString() => 'validAsOf: $validAsOf\n${_nodesById.values.toList()}';
80+
String toString() => 'validAsOf: $validAsOf\n${_nodesById.values.toList()}';
8181
}

lib/src/asset_graph/node.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class AssetNode {
1111
final AssetId id;
1212

1313
/// The [AssetId]s of all generated assets which depend on this node.
14-
final outputs = new Set<AssetId>();
14+
final Set<AssetId> outputs = new Set<AssetId>();
1515

1616
AssetNode(this.id);
1717

@@ -66,5 +66,6 @@ class GeneratedAssetNode extends AssetNode {
6666
super.serialize()..addAll([primaryInput.serialize(), wasOutput]);
6767

6868
@override
69-
toString() => 'GeneratedAssetNode: $id generated from input $primaryInput.';
69+
String toString() =>
70+
'GeneratedAssetNode: $id generated from input $primaryInput.';
7071
}

lib/src/builder/build_step_impl.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class BuildStepImpl implements BuildStep {
3535
final List<AssetId> expectedOutputs;
3636

3737
/// The [Logger] for this [BuildStep].
38+
@override
3839
Logger get logger {
3940
_logger ??= new Logger(input.id.toString());
4041
return _logger;
@@ -71,6 +72,7 @@ class BuildStepImpl implements BuildStep {
7172
}
7273

7374
/// Checks if an [Asset] by [id] exists as an input for this [BuildStep].
75+
@override
7476
Future<bool> hasInput(AssetId id) {
7577
_checkInput(id);
7678
_dependencies.add(id);

lib/src/generate/build_impl.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class BuildImpl {
172172
}
173173
var exceptionString =
174174
result.exception != null ? '\n${result.exception}' : '';
175+
175176
/// For a [FatalBuildException], the message is more important than the
176177
/// stack trace so we hide it (at least for now).
177178
var stackTraceString =

lib/src/generate/build_result.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ class BuildResult {
3131
return '''
3232
3333
Build Succeeded!
34-
Type: ${buildType}
34+
Type: $buildType
3535
''';
3636
} else {
3737
return '''
3838
3939
Build Failed :(
40-
Type: ${buildType}
41-
Exception: ${exception}
40+
Type: $buildType
41+
Exception: $exception
4242
Stack Trace:
43-
${stackTrace}
43+
$stackTrace
4444
''';
4545
}
4646
}

lib/src/generate/input_set.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class InputSet {
2020
: this.globs =
2121
new List.unmodifiable(globs.map((pattern) => new Glob(pattern)));
2222

23+
@override
2324
String toString() {
2425
var buffer = new StringBuffer()
2526
..write('InputSet: package `$package` with globs');

0 commit comments

Comments
 (0)