Skip to content

Commit 78dd2fd

Browse files
authored
Merge pull request #2 from bitsydarel/release/v2.0.3
Release/v2.0.3
2 parents 4856f0d + 0a9401b commit 78dd2fd

File tree

10 files changed

+132
-106
lines changed

10 files changed

+132
-106
lines changed

.github/workflows/release.yml

Lines changed: 79 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Dart
33
on:
44
push:
55
branches:
6-
# Push events to branches matching refs/heads/releases/10
6+
# Push events to branches matching refs/heads/releases/[version]
77
- 'release/**'
88

99
jobs:
@@ -15,7 +15,7 @@ jobs:
1515
# available. See https://hub.docker.com/r/google/dart/ for the available
1616
# images.
1717
container:
18-
image: google/dart:latest
18+
image: google/dart:latest
1919

2020
steps:
2121
- uses: actions/checkout@v2
@@ -31,21 +31,23 @@ jobs:
3131
# run: dart format --output=none --set-exit-if-changed .
3232

3333
# Consider passing '--fatal-infos' for slightly stricter analysis.
34-
- name: Analyze project source
35-
run: dart analyze
34+
# - name: Analyze project source
35+
# run: dart analyze
3636

3737
# Your project will need to have tests in test/ and a dependency on
3838
# package:test for this step to succeed. Note that Flutter projects will
3939
# want to change this to 'flutter test'.
4040
- name: Run tests
4141
run: dart test
42-
42+
4343
release:
44+
needs: [ build ]
45+
4446
runs-on: ubuntu-latest
45-
47+
4648
steps:
4749
- uses: actions/checkout@v2
48-
50+
4951
- name: Create a Release
5052
id: create_release
5153
uses: actions/create-release@v1.1.4
@@ -58,89 +60,123 @@ jobs:
5860
release_name: Release ${{ github.ref }}
5961
# Path to file with information about the tag.
6062
body_path: CHANGELOG.md # optional
61-
62-
63+
64+
6365
release-linux:
64-
needs: [release]
65-
66+
needs: [ release ]
67+
6668
runs-on: ubuntu-latest
67-
69+
6870
container:
69-
image: google/dart:latest
70-
71+
image: google/dart:latest
72+
7173
steps:
7274
- uses: actions/checkout@v2
73-
75+
7476
- name: Print Dart SDK version
7577
run: dart --version
76-
78+
7779
- name: Install dependencies
7880
run: dart pub get
79-
81+
8082
- name: Generate linux native binary
8183
run: dart2native bin/dbstyleguidechecker.dart -o bin/dbstyleguidechecker-linux
82-
84+
85+
- name: Get release
86+
id: get_release
87+
uses: bruceadams/get-release@v1.2.2
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
8391
- name: Upload Linux Build Artifact
8492
id: upload-release-asset
8593
uses: actions/upload-release-asset@v1
8694
env:
8795
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8896
with:
89-
upload_url: ${{ jobs.release.steps.create_release.outputs.upload_url }}
97+
upload_url: ${{ steps.get_release.outputs.upload_url }}
9098
asset_path: ./bin/dbstyleguidechecker-linux
9199
asset_name: dbstyleguidechecker-linux
92100
asset_content_type: application/octet-stream
93-
101+
94102
release-macos:
95-
needs: [release]
96-
103+
needs: [ release ]
104+
97105
runs-on: macos-latest
98-
99-
container:
100-
image: google/dart:latest
101-
106+
102107
steps:
108+
- uses: actions/checkout@v2
109+
110+
- name: Install brew dart repo
111+
run: brew tap dart-lang/dart
112+
113+
- name: Install dart with brew
114+
run: brew install dart
115+
116+
- name: Print Dart SDK version
117+
run: dart --version
118+
103119
- name: Install dependencies
104120
run: dart pub get
105-
121+
106122
- name: Generate MacOs native binary
107123
run: dart2native bin/dbstyleguidechecker.dart -o bin/dbstyleguidechecker-macos
108124

125+
- name: Get release
126+
id: get_release
127+
uses: bruceadams/get-release@v1.2.2
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
109131
- name: Upload MacOs Build Artifact
110132
id: upload-release-asset
111133
uses: actions/upload-release-asset@v1
112134
env:
113135
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114136
with:
115-
upload_url: ${{ jobs.release.steps.create_release.outputs.upload_url }}
137+
upload_url: ${{ steps.get_release.outputs.upload_url }}
116138
asset_path: ./bin/dbstyleguidechecker-macos
117139
asset_name: dbstyleguidechecker-macos
118140
asset_content_type: application/octet-stream
119-
141+
120142
release-windows:
121-
needs: [release]
122-
143+
needs: [ release ]
144+
123145
runs-on: windows-latest
124-
125-
container:
126-
image: google/dart:latest
127-
146+
128147
steps:
148+
- uses: actions/checkout@v2
149+
150+
- name: Install Dart SDK
151+
uses: crazy-max/ghaction-chocolatey@v1
152+
with:
153+
args: install dart-sdk
154+
155+
- name: Update Environment variable using GITHUB path to include dart binaries
156+
run: echo "C:\tools\dart-sdk\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
157+
158+
- name: Print Dart SDK version
159+
run: dart --version
160+
129161
- name: Install dependencies
130162
run: dart pub get
131-
163+
132164
- name: Generate Windows native binary
133-
run: dart2native bin/dbstyleguidechecker.dart -o bin/dbstyleguidechecker-windows
134-
165+
run: dart2native bin/dbstyleguidechecker.dart -o bin/dbstyleguidechecker-windows.exe
166+
167+
- name: Get release
168+
id: get_release
169+
uses: bruceadams/get-release@v1.2.2
170+
env:
171+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+
135173
- name: Upload Windows Build Artifact
136174
id: upload-release-asset
137175
uses: actions/upload-release-asset@v1
138176
env:
139177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140178
with:
141-
upload_url: ${{ jobs.release.steps.create_release.outputs.upload_url }}
142-
asset_path: ./bin/dbstyleguidechecker-windows
143-
asset_name: dbstyleguidechecker-windows
179+
upload_url: ${{ steps.get_release.outputs.upload_url }}
180+
asset_path: ./bin/dbstyleguidechecker-windows.exe
181+
asset_name: dbstyleguidechecker-windows.exe
144182
asset_content_type: application/octet-stream
145-
146-

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Removed stack trace in error message.
1717

1818
## 2.0.0
19+
1920
- Redesign of the script arguments.
2021

2122
- An updated documentation with examples and guide for installations.
@@ -24,4 +25,12 @@
2425

2526
## 2.0.1
2627

27-
- Cleaner README.md
28+
- Cleaner README.md
29+
30+
## 2.0.2
31+
32+
- dart format to improve score
33+
34+
## 2.0.3
35+
36+
- code cleanup and improvement

analysis_options.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
# Defines a default set of lint rules enforced for
2-
# projects at Google. For details and rationale,
3-
# see https://github.com/dart-lang/pedantic#enabled-lints.
41
include: package:flutter_code_style/analysis_options.yaml
5-
6-
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
7-
# Uncomment to specify additional rules.
8-
# linter:
9-
# rules:
10-
# - camel_case_types
11-
12-
analyzer:
13-
exclude:
14-
- test/**

bin/dbstyleguidechecker.dart

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,13 @@ Future<void> main(List<String> arguments) async {
3434

3535
Directory.current = scriptArgument.projectDir.path;
3636

37-
CodeStylesViolationsReporter reporter;
38-
39-
try {
40-
reporter = _createReporter(scriptArgument);
41-
} on UnrecoverableException catch (exception) {
42-
printHelpMessage(exception.reason);
43-
exitCode = exception.exitCode;
44-
return;
45-
}
46-
4737
CodeStyleViolationsChecker checker;
4838

4939
try {
50-
checker = createParser(scriptArgument, reporter);
40+
final CodeStylesViolationsReporter reporter =
41+
_createReporter(scriptArgument);
42+
43+
checker = _createChecker(scriptArgument, reporter);
5144
} on UnrecoverableException catch (exception) {
5245
printHelpMessage(exception.reason);
5346
exitCode = exception.exitCode;
@@ -64,9 +57,9 @@ Future<void> main(List<String> arguments) async {
6457
});
6558
}
6659

67-
CodeStyleViolationsChecker createParser(
68-
ScriptArgument scriptArgument,
69-
CodeStylesViolationsReporter reporter,
60+
CodeStyleViolationsChecker _createChecker(
61+
final ScriptArgument scriptArgument,
62+
final CodeStylesViolationsReporter reporter,
7063
) {
7164
switch (scriptArgument.projectType) {
7265
case dartProjectType:
@@ -94,7 +87,9 @@ CodeStyleViolationsChecker createParser(
9487
}
9588
}
9689

97-
CodeStylesViolationsReporter _createReporter(ScriptArgument scriptArgument) {
90+
CodeStylesViolationsReporter _createReporter(
91+
final ScriptArgument scriptArgument,
92+
) {
9893
switch (scriptArgument.reporterType) {
9994
case reporterOfTypeConsole:
10095
return const ConsoleCodeStyleViolationsReporter();
@@ -103,7 +98,7 @@ CodeStylesViolationsReporter _createReporter(ScriptArgument scriptArgument) {
10398
final File reporterOutputFile = scriptArgument.reporterOutputFile;
10499

105100
if (reporterOutputFile == null) {
106-
throw UnrecoverableException(
101+
throw const UnrecoverableException(
107102
"Reporter of type 'file' specified "
108103
'but reporter output file not specified.',
109104
exitMissingRequiredArgument,
@@ -115,7 +110,7 @@ CodeStylesViolationsReporter _createReporter(ScriptArgument scriptArgument) {
115110
final VcsArgument vcs = scriptArgument.vcs;
116111

117112
if (vcs == null) {
118-
throw UnrecoverableException(
113+
throw const UnrecoverableException(
119114
"Reporter of type 'github' specified but vcs parameter not specified",
120115
exitMissingRequiredArgument,
121116
);
@@ -129,7 +124,7 @@ CodeStylesViolationsReporter _createReporter(ScriptArgument scriptArgument) {
129124
);
130125
break;
131126
default:
132-
throw UnrecoverableException(
127+
throw const UnrecoverableException(
133128
'Invalid reporter type provided or not supported',
134129
exitInvalidArgument,
135130
);

lib/src/parsers/dart/dart_analyzer_violation_parser.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ class DartAnalyzerViolationParser extends CodeStyleViolationsParser {
1414
static final RegExp _regexp = RegExp(
1515
// ignore: prefer_interpolation_to_compose_strings
1616
'^' + // beginning of line
17-
'([\\w_\\.]+)\\|' * 3 + // first three error notes
18-
'([^\\|]+)\\|' + // file path
19-
'([\\w_\\.]+)\\|' * 3 + // line, column, length
17+
r'([\w_\.]+)\|' * 3 + // first three error notes
18+
r'([^\|]+)\|' + // file path
19+
r'([\w_\.]+)\|' * 3 + // line, column, length
2020
'(.*?)' + // rest is the error message
21-
'\$', // end of line
21+
r'$', // end of line
2222
);
2323

2424
@override

lib/src/utils/file_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:dbstyleguidechecker/src/exceptions.dart';
55
import 'package:path/path.dart' as path;
66

77
final RegExp _diffFinder = RegExp(
8-
'^@@\\s-(\\d+),\\d+\\s\\+(\\d+),\\d+\\s@@',
8+
r'^@@\s-(\d+),\d+\s\+(\d+),\d+\s@@',
99
);
1010

1111
/// Get the relative path of a file from it's parent directory.

0 commit comments

Comments
 (0)