Skip to content

Commit a2f20c4

Browse files
authored
Release/v0.0.1 dev.3 (#3)
* style: Added very_good_analysis for hooks * style: Added exception for template analysis * build: Added very_good_analysis dependency * style: Fixed analysis issues * ci: Added GitHub workflow
1 parent e3b9efc commit a2f20c4

File tree

6 files changed

+61
-5
lines changed

6 files changed

+61
-5
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Very Good Workflow
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "lib/**"
7+
- "test/**"
8+
- "pubspec.yaml"
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- "hooks/**"
14+
- "hooks/test/**"
15+
- "pubspec.yaml"
16+
17+
jobs:
18+
semantic-pull-request:
19+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1
20+
21+
build:
22+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
23+
24+
ci:
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: ./hooks
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: dart-lang/setup-dart@v1
33+
34+
- name: Install Dependencies
35+
run: dart pub get
36+
37+
- name: Format
38+
run: dart format --set-exit-if-changed .
39+
40+
- name: Analyze
41+
run: dart analyze --fatal-infos --fatal-warnings .
42+
43+
- name: Run Tests
44+
run: |
45+
dart pub global activate coverage 1.3.0
46+
dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --report-on=lib
47+
48+
- name: Upload coverage to Codecov
49+
uses: codecov/codecov-action@v1

analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Don't analyze templates
2+
analyzer:
3+
exclude: [__brick__]

hooks/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:very_good_analysis/analysis_options.3.0.1.yaml

hooks/post_gen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:mason/mason.dart';
55
const String androidBuild = 'build.gradle';
66
const String flutterBuild = 'lib';
77

8-
void run(HookContext context) async {
8+
Future<void> run(HookContext context) async {
99
final logger = context.logger;
1010

1111
await _runPubAdd(logger);
@@ -42,6 +42,6 @@ Future<void> _runDartFix(Logger logger) async {
4242
final progress = logger.progress('Running dart fix --apply');
4343
final result = await Process.run('dart', ['fix', '--apply']);
4444
return result.exitCode == 0
45-
? progress.complete('Fix applied')
46-
: progress.fail('Fix couldn\'t be applied');
45+
? progress.complete('Fix applied.')
46+
: progress.fail("Fix couldn't be applied");
4747
}

hooks/pre_gen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import 'package:mason/mason.dart';
33
const defaultAppPackage = 'com.example.app';
44

55
void run(HookContext context) {
6-
final isAndroid = context.vars['android'];
7-
final isIOS = context.vars['ios'];
6+
final isAndroid = context.vars['android'] as bool;
7+
final isIOS = context.vars['ios'] as bool;
88

99
if (isAndroid) parseAndroidData(context);
1010

hooks/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ environment:
55

66
dependencies:
77
mason: ^0.1.0-dev
8+
9+
dev_dependencies:
10+
very_good_analysis: ^3.1.0

0 commit comments

Comments
 (0)