Skip to content

Commit 4969e7d

Browse files
authored
Enable and fix lints, fix changelog, prepare v1.2.7 (#640)
Fixes #638
1 parent 8b0e7a8 commit 4969e7d

16 files changed

+44
-79
lines changed

.github/workflows/dart.yml

Lines changed: 5 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -143,50 +143,6 @@ jobs:
143143
if: "always() && steps.source_gen_pub_upgrade.conclusion == 'success'"
144144
working-directory: source_gen
145145
job_004:
146-
name: "analyze_format; windows; Dart 2.18.0; PKG: source_gen; `dart analyze`"
147-
runs-on: windows-latest
148-
steps:
149-
- name: Setup Dart SDK
150-
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
151-
with:
152-
sdk: "2.18.0"
153-
- id: checkout
154-
name: Checkout repository
155-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
156-
- id: source_gen_pub_upgrade
157-
name: source_gen; dart pub upgrade
158-
run: dart pub upgrade
159-
if: "always() && steps.checkout.conclusion == 'success'"
160-
working-directory: source_gen
161-
- name: source_gen; dart analyze
162-
run: dart analyze
163-
if: "always() && steps.source_gen_pub_upgrade.conclusion == 'success'"
164-
working-directory: source_gen
165-
job_005:
166-
name: "analyze_format; windows; Dart dev; PKG: source_gen; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
167-
runs-on: windows-latest
168-
steps:
169-
- name: Setup Dart SDK
170-
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
171-
with:
172-
sdk: dev
173-
- id: checkout
174-
name: Checkout repository
175-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
176-
- id: source_gen_pub_upgrade
177-
name: source_gen; dart pub upgrade
178-
run: dart pub upgrade
179-
if: "always() && steps.checkout.conclusion == 'success'"
180-
working-directory: source_gen
181-
- name: "source_gen; dart format --output=none --set-exit-if-changed ."
182-
run: "dart format --output=none --set-exit-if-changed ."
183-
if: "always() && steps.source_gen_pub_upgrade.conclusion == 'success'"
184-
working-directory: source_gen
185-
- name: "source_gen; dart analyze --fatal-infos ."
186-
run: dart analyze --fatal-infos .
187-
if: "always() && steps.source_gen_pub_upgrade.conclusion == 'success'"
188-
working-directory: source_gen
189-
job_006:
190146
name: "unit_test; linux; Dart 2.18.0; PKG: example_usage; `dart test --run-skipped`"
191147
runs-on: ubuntu-latest
192148
steps:
@@ -220,9 +176,7 @@ jobs:
220176
- job_001
221177
- job_002
222178
- job_003
223-
- job_004
224-
- job_005
225-
job_007:
179+
job_005:
226180
name: "unit_test; linux; Dart 2.18.0; PKG: source_gen; `dart test`"
227181
runs-on: ubuntu-latest
228182
steps:
@@ -256,9 +210,7 @@ jobs:
256210
- job_001
257211
- job_002
258212
- job_003
259-
- job_004
260-
- job_005
261-
job_008:
213+
job_006:
262214
name: "unit_test; linux; Dart dev; PKG: example_usage; `dart test --run-skipped`"
263215
runs-on: ubuntu-latest
264216
steps:
@@ -292,9 +244,7 @@ jobs:
292244
- job_001
293245
- job_002
294246
- job_003
295-
- job_004
296-
- job_005
297-
job_009:
247+
job_007:
298248
name: "unit_test; linux; Dart dev; PKG: source_gen; `dart test`"
299249
runs-on: ubuntu-latest
300250
steps:
@@ -328,9 +278,7 @@ jobs:
328278
- job_001
329279
- job_002
330280
- job_003
331-
- job_004
332-
- job_005
333-
job_010:
281+
job_008:
334282
name: "unit_test; windows; Dart 2.18.0; PKG: source_gen; `dart test`"
335283
runs-on: windows-latest
336284
steps:
@@ -354,9 +302,7 @@ jobs:
354302
- job_001
355303
- job_002
356304
- job_003
357-
- job_004
358-
- job_005
359-
job_011:
305+
job_009:
360306
name: "unit_test; windows; Dart dev; PKG: source_gen; `dart test`"
361307
runs-on: windows-latest
362308
steps:
@@ -380,5 +326,3 @@ jobs:
380326
- job_001
381327
- job_002
382328
- job_003
383-
- job_004
384-
- job_005

analysis_options.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ linter:
2222
- avoid_void_async
2323
- cancel_subscriptions
2424
- cascade_invocations
25+
- collection_methods_unrelated_type
26+
- combinators_ordering
2527
- comment_references
28+
- dangling_library_doc_comments
2629
- directives_ordering
30+
- implicit_call_tearoffs
2731
- join_return_with_assignment
32+
- library_annotations
2833
- lines_longer_than_80_chars
2934
- literal_only_boolean_expressions
3035
- missing_whitespace_between_adjacent_strings
@@ -40,14 +45,21 @@ linter:
4045
- prefer_relative_imports
4146
- prefer_single_quotes
4247
- require_trailing_commas
48+
- sort_child_properties_last
4349
- sort_pub_dependencies
4450
- test_types_in_equals
4551
- throw_in_finally
4652
- type_annotate_public_apis
4753
- unawaited_futures
4854
- unnecessary_await_in_return
4955
- unnecessary_lambdas
56+
- unnecessary_library_directive
5057
- unnecessary_parenthesis
5158
- unnecessary_statements
59+
- unreachable_from_main
60+
- unsafe_html
61+
- use_full_hex_values_for_flutter_colors
5262
- use_is_even_rather_than_modulo
5363
- use_string_buffers
64+
- use_string_in_part_of_directives
65+
- use_super_parameters

example_usage/test/ensure_build_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@Timeout.factor(2)
66
@TestOn('vm')
77
@Tags(['presubmit-only'])
8+
library test;
9+
810
import 'package:build_verify/build_verify.dart';
911
import 'package:test/test.dart';
1012

source_gen/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
## 1.2.8-dev
2-
31
## 1.2.7
42

53
* Update the value of the pubspec `repository` field.

source_gen/lib/source_gen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
export 'src/builder.dart'
6-
show defaultFileHeader, LibraryBuilder, PartBuilder, SharedPartBuilder;
6+
show LibraryBuilder, PartBuilder, SharedPartBuilder, defaultFileHeader;
77
export 'src/constants/reader.dart' show ConstantReader;
88
export 'src/constants/revive.dart' show Revivable;
99
export 'src/generator.dart' show Generator, InvalidGenerationSourceError;

source_gen/lib/src/builder.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
//TODO(kevmoo): https://github.com/dart-lang/linter/issues/3563
6+
// ignore_for_file: use_super_parameters
7+
58
import 'dart:convert';
69

710
import 'package:analyzer/dart/ast/ast.dart';

source_gen/lib/src/constants/reader.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'package:analyzer/dart/constant/value.dart';
66
import 'package:analyzer/dart/element/element.dart';
77
import 'package:analyzer/dart/element/type.dart';
8-
import 'package:meta/meta.dart';
98

109
import '../type_checker.dart';
1110
import 'revive.dart';
@@ -115,10 +114,8 @@ abstract class ConstantReader {
115114
}
116115

117116
class _NullConstant extends ConstantReader {
118-
@alwaysThrows
119-
static T _throw<T>(String expected) {
120-
throw FormatException('Not an instance of $expected.');
121-
}
117+
static T _throw<T>(String expected) =>
118+
throw FormatException('Not an instance of $expected.');
122119

123120
const _NullConstant() : super._();
124121

source_gen/mono_pkg.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ sdk:
33
- pubspec
44
- dev
55

6-
os:
7-
- linux
8-
- windows
9-
106
stages:
117
- analyze_format:
128
- group:
@@ -17,7 +13,11 @@ stages:
1713
- analyze
1814
sdk: pubspec
1915
- unit_test:
20-
- test
16+
- group:
17+
- test
18+
os:
19+
- linux
20+
- windows
2121

2222
cache:
2323
directories:

source_gen/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: source_gen
2-
version: 1.2.8-dev
2+
version: 1.2.7
33
description: >-
44
Source code generation builders and utilities for the Dart build system
55
repository: https://github.com/dart-lang/source_gen/tree/master/source_gen
@@ -13,7 +13,6 @@ dependencies:
1313
build: ^2.1.0
1414
dart_style: ^2.0.0
1515
glob: ^2.0.0
16-
meta: ^1.3.0
1716
path: ^1.8.0
1817
source_span: ^1.8.0
1918
yaml: ^3.0.0

source_gen/test/builder_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
@TestOn('vm')
6+
library test;
7+
68
import 'dart:async';
79

810
import 'package:build/build.dart';

source_gen/test/external_only_type_checker_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
// Increase timeouts on this test which resolves source code and can be slow.
99
@Timeout.factor(2.0)
10+
library test;
11+
1012
import 'package:analyzer/dart/element/nullability_suffix.dart';
1113
import 'package:analyzer/dart/element/type.dart';
1214
import 'package:build/build.dart';

source_gen/test/generator_for_annotation_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// The first test that runs `testBuilder` takes a LOT longer than the rest.
66
@Timeout.factor(3)
7+
library test;
8+
79
import 'package:analyzer/dart/analysis/utilities.dart';
810
import 'package:analyzer/dart/ast/ast.dart';
911
import 'package:analyzer/dart/element/element.dart';

source_gen/test/test_files/annotated_classes.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library source_gen.test.annotation_test.classes;
6-
75
import 'package:_test_annotations/test_annotations.dart';
86

97
import 'annotations.dart';

source_gen/test/test_files/annotated_classes_part.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
part of source_gen.test.annotation_test.classes;
5+
part of 'annotated_classes.dart';
66

77
const localUntypedAnnotationInPart = PublicAnnotationClass();
88

source_gen/test/type_checker_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// ignore_for_file: unreachable_from_main
6+
57
// Increase timeouts on this test which resolves source code and can be slow.
68
@Timeout.factor(2.0)
9+
library test;
10+
711
import 'dart:collection';
812

913
import 'package:analyzer/dart/element/element.dart';

source_gen/test/utils_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// Increase timeouts on this test which resolves source code and can be slow.
66
@Timeout.factor(2.0)
7+
library test;
8+
79
import 'package:analyzer/dart/element/element.dart';
810
import 'package:build_test/build_test.dart';
911
import 'package:source_gen/src/utils.dart';

0 commit comments

Comments
 (0)