Skip to content

Commit 01783eb

Browse files
authored
Switch to GitHub actions, update analysis options, fix analysis issues. (dart-archive/platform#35)
This removes Travis configuration and switches to GitHub actions. Also, updated the analysis options to use package:lints/recommended.yaml.
1 parent 396db1f commit 01783eb

File tree

10 files changed

+61
-138
lines changed

10 files changed

+61
-138
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Process Package
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
correctness:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
15+
- uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603
16+
with:
17+
sdk: dev
18+
- name: Install dependencies
19+
run: dart pub upgrade
20+
- name: Verify formatting
21+
run: dart format --output=none --set-exit-if-changed .
22+
- name: Analyze project source
23+
run: dart analyze --fatal-infos
24+
test:
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
os: [ubuntu-latest, macos-latest, windows-latest]
29+
sdk: [stable, beta, dev]
30+
steps:
31+
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
32+
- uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603
33+
with:
34+
sdk: ${{ matrix.sdk }}
35+
- name: Install dependencies
36+
run: dart pub upgrade
37+
- name: Run Tests
38+
run: dart test

pkgs/platform/.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,6 @@
1+
include: package:lints/recommended.yaml
2+
13
analyzer:
2-
enable-experiment:
3-
- non-nullable
44
errors:
55
# Allow having TODOs in the code
66
todo: ignore
7-
8-
linter:
9-
rules:
10-
# these rules are documented on and in the same order as
11-
# the Dart Lint rules page to make maintenance easier
12-
# http://dart-lang.github.io/linter/lints/
13-
14-
# === error rules ===
15-
- avoid_empty_else
16-
- comment_references
17-
- cancel_subscriptions
18-
- close_sinks
19-
- control_flow_in_finally
20-
- empty_statements
21-
- hash_and_equals
22-
- invariant_booleans
23-
- iterable_contains_unrelated_type
24-
- list_remove_unrelated_type
25-
- literal_only_boolean_expressions
26-
- test_types_in_equals
27-
- throw_in_finally
28-
- unrelated_type_equality_checks
29-
- valid_regexps
30-
31-
# === style rules ===
32-
- always_declare_return_types
33-
- always_specify_types
34-
- annotate_overrides
35-
- avoid_as
36-
- avoid_init_to_null
37-
- avoid_return_types_on_setters
38-
- await_only_futures
39-
- camel_case_types
40-
- constant_identifier_names
41-
- empty_constructor_bodies
42-
- implementation_imports
43-
- library_names
44-
- library_prefixes
45-
- non_constant_identifier_names
46-
- one_member_abstracts
47-
- only_throw_errors
48-
- overridden_fields
49-
- package_api_docs
50-
- package_prefixed_library_names
51-
- prefer_is_not_empty
52-
- public_member_api_docs
53-
- slash_for_doc_comments
54-
- sort_constructors_first
55-
- sort_unnamed_constructors_first
56-
- type_annotate_public_apis
57-
- type_init_formals
58-
- unawaited_futures
59-
- unnecessary_getters_setters
60-
61-
# === pub rules ===
62-
- package_names

pkgs/platform/dev/setup.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

pkgs/platform/dev/travis.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

pkgs/platform/lib/src/interface/local_platform.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class LocalPlatform extends Platform {
4242
List<String> get executableArguments => io.Platform.executableArguments;
4343

4444
@override
45-
String? get packageRoot =>
46-
io.Platform.packageRoot; // ignore: deprecated_member_use
45+
String? get packageRoot => null;
4746

4847
@override
4948
String? get packageConfig => io.Platform.packageConfig;

pkgs/platform/lib/src/interface/platform.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,14 @@ abstract class Platform {
159159
/// list containing the flags passed to the executable.
160160
List<String> get executableArguments;
161161

162-
/// The value of the `--package-root` flag passed to the executable
163-
/// used to run the script in this isolate. This is the directory in which
164-
/// Dart packages are looked up.
162+
/// Deprecated, do not use.
165163
///
166-
/// If there is no `--package-root` flag, `null` is returned.
167-
@deprecated
164+
/// This used to be the value of the `--package-root` flag passed to the
165+
/// executable used to run the script in this isolate, but is no longer
166+
/// supported in Dart 2.
167+
///
168+
/// Always returns null.
169+
@Deprecated('packages/ directory resolution is not supported in Dart 2.')
168170
String? get packageRoot;
169171

170172
/// The value of the `--packages` flag passed to the executable

pkgs/platform/lib/src/testing/fake_platform.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class FakePlatform extends Platform {
7272
/// [json] must be a JSON string that matches the encoding produced by
7373
/// [toJson].
7474
factory FakePlatform.fromJson(String json) {
75-
Map<String, dynamic> map = new JsonDecoder().convert(json);
76-
return new FakePlatform(
75+
Map<String, dynamic> map = JsonDecoder().convert(json);
76+
return FakePlatform(
7777
numberOfProcessors: map['numberOfProcessors'],
7878
pathSeparator: map['pathSeparator'],
7979
operatingSystem: map['operatingSystem'],

pkgs/platform/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ environment:
77
sdk: '>=2.12.0 <3.0.0'
88

99
dev_dependencies:
10+
lints: ^1.0.1
1011
test: ^1.16.8

pkgs/platform/test/fake_platform_test.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ void main() {
3232
late LocalPlatform local;
3333

3434
setUp(() {
35-
fake = new FakePlatform();
36-
local = new LocalPlatform();
35+
fake = FakePlatform();
36+
local = LocalPlatform();
3737
});
3838

3939
group('fromPlatform', () {
4040
setUp(() {
41-
fake = new FakePlatform.fromPlatform(local);
41+
fake = FakePlatform.fromPlatform(local);
4242
});
4343

4444
test('copiesAllProperties', () {
@@ -61,7 +61,7 @@ void main() {
6161

6262
group('copyWith', () {
6363
setUp(() {
64-
fake = new FakePlatform.fromPlatform(local);
64+
fake = FakePlatform.fromPlatform(local);
6565
});
6666

6767
test('overrides a value, but leaves others intact', () {
@@ -85,7 +85,7 @@ void main() {
8585
expect(copy.localeName, local.localeName);
8686
});
8787
test('can override all values', () {
88-
fake = new FakePlatform(
88+
fake = FakePlatform(
8989
numberOfProcessors: 8,
9090
pathSeparator: ':',
9191
operatingSystem: 'fake',
@@ -94,7 +94,7 @@ void main() {
9494
environment: <String, String>{'PATH': '.'},
9595
executable: 'executable',
9696
resolvedExecutable: '/executable',
97-
script: new Uri.file('/platform/test/fake_platform_test.dart'),
97+
script: Uri.file('/platform/test/fake_platform_test.dart'),
9898
executableArguments: <String>['scriptarg'],
9999
version: '0.1.1',
100100
stdinSupportsAnsi: false,
@@ -125,8 +125,8 @@ void main() {
125125

126126
group('json', () {
127127
test('fromJson', () {
128-
String json = new io.File('test/platform.json').readAsStringSync();
129-
fake = new FakePlatform.fromJson(json);
128+
String json = io.File('test/platform.json').readAsStringSync();
129+
fake = FakePlatform.fromJson(json);
130130
expect(fake.numberOfProcessors, 8);
131131
expect(fake.pathSeparator, '/');
132132
expect(fake.operatingSystem, 'macos');
@@ -139,7 +139,7 @@ void main() {
139139
expect(fake.executable, '/bin/dart');
140140
expect(fake.resolvedExecutable, '/bin/dart');
141141
expect(fake.script,
142-
new Uri.file('/platform/test/fake_platform_test.dart'));
142+
Uri.file('/platform/test/fake_platform_test.dart'));
143143
expect(fake.executableArguments, <String>['--checked']);
144144
expect(fake.packageRoot, null);
145145
expect(fake.packageConfig, null);
@@ -148,7 +148,7 @@ void main() {
148148
});
149149

150150
test('fromJsonToJson', () {
151-
fake = new FakePlatform.fromJson(local.toJson());
151+
fake = FakePlatform.fromJson(local.toJson());
152152
_expectPlatformsEqual(fake, local);
153153
});
154154
});

0 commit comments

Comments
 (0)