danger-dart-linter 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +120 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +291 -0
- data/Guardfile +14 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +17 -0
- data/danger-dart-linter.gemspec +28 -0
- data/lib/danger_dart_linter.rb +1 -0
- data/lib/danger_plugin.rb +1 -0
- data/lib/dart_linter/dart_analyze_parser.rb +33 -0
- data/lib/dart_linter/gem_version.rb +3 -0
- data/lib/dart_linter/plugin.rb +91 -0
- data/spec/dart_lint_spec.rb +159 -0
- data/spec/fixtures/dart_analyze_with_violations.txt +10 -0
- data/spec/fixtures/dart_analyze_without_violations.txt +5 -0
- data/spec/spec_helper.rb +57 -0
- metadata +147 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2559d63a958fe6d5e9922825552284fbda90c27cf62ff8ecd7b59537913ca471
|
|
4
|
+
data.tar.gz: 1270f0e48131c731594d5dddc4c21300d140daa7c1791cbe1be109a51c081560
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 76991e059fbae5d3bee824839dda61edd7cfe19da5fa074045049a8ee47e9e7cdc034536436d759b023fdbc01365496cc60babe3a5adcb346ea8cbda96af4b45
|
|
7
|
+
data.tar.gz: fac44d8eb1a97c9b39dbb37f70e1581d84c84d7bffb078a2290054d86c7db1fab6ce7506618a646dc1239c126e276ab800da9d1e8e16d93bb975b9f6e51a43ab
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 2.2
|
|
3
|
+
|
|
4
|
+
Style/StringLiterals:
|
|
5
|
+
EnforcedStyle: double_quotes
|
|
6
|
+
Enabled: true
|
|
7
|
+
|
|
8
|
+
Style/ClassCheck:
|
|
9
|
+
EnforcedStyle: kind_of?
|
|
10
|
+
|
|
11
|
+
Lint/UselessAssignment:
|
|
12
|
+
Exclude:
|
|
13
|
+
- '**/spec/**/*'
|
|
14
|
+
|
|
15
|
+
Layout/EndOfLine:
|
|
16
|
+
EnforcedStyle: lf
|
|
17
|
+
|
|
18
|
+
Layout/HeredocIndentation:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Layout/HashAlignment:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Layout/DotPosition:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Style/DoubleNegation:
|
|
28
|
+
Enabled: false
|
|
29
|
+
|
|
30
|
+
Lint/UnusedBlockArgument:
|
|
31
|
+
Enabled: false
|
|
32
|
+
|
|
33
|
+
Style/ClassAndModuleChildren:
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
Metrics/AbcSize:
|
|
37
|
+
Max: 60
|
|
38
|
+
|
|
39
|
+
Style/WordArray:
|
|
40
|
+
MinSize: 19
|
|
41
|
+
|
|
42
|
+
Style/SignalException:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
Style/RedundantReturn:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
Style/IfUnlessModifier:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
Style/AndOr:
|
|
52
|
+
Enabled: false
|
|
53
|
+
|
|
54
|
+
Metrics/ClassLength:
|
|
55
|
+
Max: 350
|
|
56
|
+
|
|
57
|
+
Metrics/CyclomaticComplexity:
|
|
58
|
+
Max: 17
|
|
59
|
+
|
|
60
|
+
Layout/LineLength:
|
|
61
|
+
Max: 370
|
|
62
|
+
|
|
63
|
+
Metrics/ParameterLists:
|
|
64
|
+
Max: 10
|
|
65
|
+
|
|
66
|
+
Metrics/PerceivedComplexity:
|
|
67
|
+
Max: 18
|
|
68
|
+
|
|
69
|
+
Style/GuardClause:
|
|
70
|
+
Enabled: false
|
|
71
|
+
|
|
72
|
+
Style/ConditionalAssignment:
|
|
73
|
+
Enabled: false
|
|
74
|
+
|
|
75
|
+
Style/RedundantSelf:
|
|
76
|
+
Enabled: false
|
|
77
|
+
|
|
78
|
+
Metrics/MethodLength:
|
|
79
|
+
Max: 60
|
|
80
|
+
|
|
81
|
+
Style/Documentation:
|
|
82
|
+
Enabled: false
|
|
83
|
+
|
|
84
|
+
Style/IfInsideElse:
|
|
85
|
+
Enabled: false
|
|
86
|
+
|
|
87
|
+
Style/BlockComments:
|
|
88
|
+
Enabled: false
|
|
89
|
+
|
|
90
|
+
Layout/MultilineMethodCallIndentation:
|
|
91
|
+
EnforcedStyle: indented
|
|
92
|
+
|
|
93
|
+
Metrics/BlockLength:
|
|
94
|
+
Max: 345
|
|
95
|
+
Exclude:
|
|
96
|
+
- "**/*_spec.rb"
|
|
97
|
+
|
|
98
|
+
Style/MixinGrouping:
|
|
99
|
+
Enabled: false
|
|
100
|
+
|
|
101
|
+
Layout/HeredocIndentation:
|
|
102
|
+
Enabled: false
|
|
103
|
+
|
|
104
|
+
Style/SpecialGlobalVars:
|
|
105
|
+
Enabled: false
|
|
106
|
+
|
|
107
|
+
PercentLiteralDelimiters:
|
|
108
|
+
PreferredDelimiters:
|
|
109
|
+
"%": ()
|
|
110
|
+
"%i": ()
|
|
111
|
+
"%q": ()
|
|
112
|
+
"%Q": ()
|
|
113
|
+
"%r": "{}"
|
|
114
|
+
"%s": ()
|
|
115
|
+
"%w": ()
|
|
116
|
+
"%W": ()
|
|
117
|
+
"%x": ()
|
|
118
|
+
|
|
119
|
+
Security/YAMLLoad:
|
|
120
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
danger-dart-linter (1.0.0)
|
|
5
|
+
danger-plugin-api (~> 1.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
activesupport (8.1.3)
|
|
11
|
+
base64
|
|
12
|
+
bigdecimal
|
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
14
|
+
connection_pool (>= 2.2.5)
|
|
15
|
+
drb
|
|
16
|
+
i18n (>= 1.6, < 2)
|
|
17
|
+
json
|
|
18
|
+
logger (>= 1.4.2)
|
|
19
|
+
minitest (>= 5.1)
|
|
20
|
+
securerandom (>= 0.3)
|
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
+
uri (>= 0.13.1)
|
|
23
|
+
addressable (2.9.0)
|
|
24
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
25
|
+
ast (2.4.3)
|
|
26
|
+
base64 (0.3.0)
|
|
27
|
+
bigdecimal (4.1.2)
|
|
28
|
+
claide (1.1.0)
|
|
29
|
+
claide-plugins (0.9.2)
|
|
30
|
+
cork
|
|
31
|
+
nap
|
|
32
|
+
open4 (~> 1.3)
|
|
33
|
+
coderay (1.1.3)
|
|
34
|
+
colored2 (3.1.2)
|
|
35
|
+
concurrent-ruby (1.3.7)
|
|
36
|
+
connection_pool (3.0.2)
|
|
37
|
+
cork (0.3.0)
|
|
38
|
+
colored2 (~> 3.1)
|
|
39
|
+
danger (9.6.0)
|
|
40
|
+
base64 (~> 0.2)
|
|
41
|
+
claide (~> 1.0)
|
|
42
|
+
claide-plugins (>= 0.9.2)
|
|
43
|
+
colored2 (>= 3.1, < 5)
|
|
44
|
+
cork (~> 0.1)
|
|
45
|
+
faraday (>= 0.9.0, < 3.0)
|
|
46
|
+
faraday-http-cache (~> 2.0)
|
|
47
|
+
git (>= 1.13)
|
|
48
|
+
kramdown (>= 2.5.1, < 3.0)
|
|
49
|
+
kramdown-parser-gfm (~> 1.0)
|
|
50
|
+
octokit (>= 4.0)
|
|
51
|
+
pstore (~> 0.1)
|
|
52
|
+
terminal-table (>= 1, < 5)
|
|
53
|
+
danger-plugin-api (1.0.0)
|
|
54
|
+
danger (> 2.0)
|
|
55
|
+
diff-lcs (1.6.2)
|
|
56
|
+
docile (1.4.1)
|
|
57
|
+
drb (2.2.3)
|
|
58
|
+
faraday (2.14.3)
|
|
59
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
60
|
+
json
|
|
61
|
+
logger
|
|
62
|
+
faraday-http-cache (2.7.0)
|
|
63
|
+
faraday (>= 0.8)
|
|
64
|
+
faraday-net_http (3.4.4)
|
|
65
|
+
net-http (~> 0.5)
|
|
66
|
+
ffi (1.17.4-x64-mingw-ucrt)
|
|
67
|
+
formatador (1.2.3)
|
|
68
|
+
reline
|
|
69
|
+
git (4.3.2)
|
|
70
|
+
activesupport (>= 5.0)
|
|
71
|
+
addressable (~> 2.8)
|
|
72
|
+
process_executer (~> 4.0)
|
|
73
|
+
rchardet (~> 1.9)
|
|
74
|
+
guard (2.20.1)
|
|
75
|
+
formatador (>= 0.2.4)
|
|
76
|
+
listen (>= 2.7, < 4.0)
|
|
77
|
+
logger (~> 1.6)
|
|
78
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
79
|
+
nenv (~> 0.1)
|
|
80
|
+
notiffany (~> 0.0)
|
|
81
|
+
pry (>= 0.13.0)
|
|
82
|
+
shellany (~> 0.0)
|
|
83
|
+
thor (>= 0.18.1)
|
|
84
|
+
guard-compat (1.2.1)
|
|
85
|
+
guard-rspec (4.7.3)
|
|
86
|
+
guard (~> 2.1)
|
|
87
|
+
guard-compat (~> 1.1)
|
|
88
|
+
rspec (>= 2.99.0, < 4.0)
|
|
89
|
+
i18n (1.15.2)
|
|
90
|
+
concurrent-ruby (~> 1.0)
|
|
91
|
+
io-console (0.8.2)
|
|
92
|
+
json (2.20.0)
|
|
93
|
+
kramdown (2.5.2)
|
|
94
|
+
rexml (>= 3.4.4)
|
|
95
|
+
kramdown-parser-gfm (1.1.0)
|
|
96
|
+
kramdown (~> 2.0)
|
|
97
|
+
language_server-protocol (3.17.0.5)
|
|
98
|
+
lint_roller (1.1.0)
|
|
99
|
+
listen (3.10.0)
|
|
100
|
+
logger
|
|
101
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
102
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
103
|
+
logger (1.7.0)
|
|
104
|
+
lumberjack (1.4.2)
|
|
105
|
+
method_source (1.1.0)
|
|
106
|
+
minitest (6.0.6)
|
|
107
|
+
drb (~> 2.0)
|
|
108
|
+
prism (~> 1.5)
|
|
109
|
+
nap (1.1.0)
|
|
110
|
+
nenv (0.3.0)
|
|
111
|
+
net-http (0.9.1)
|
|
112
|
+
uri (>= 0.11.1)
|
|
113
|
+
notiffany (0.1.3)
|
|
114
|
+
nenv (~> 0.1)
|
|
115
|
+
shellany (~> 0.0)
|
|
116
|
+
octokit (10.0.0)
|
|
117
|
+
faraday (>= 1, < 3)
|
|
118
|
+
sawyer (~> 0.9)
|
|
119
|
+
open4 (1.3.4)
|
|
120
|
+
parallel (2.1.0)
|
|
121
|
+
parser (3.3.11.1)
|
|
122
|
+
ast (~> 2.4.1)
|
|
123
|
+
racc
|
|
124
|
+
prism (1.9.0)
|
|
125
|
+
process_executer (4.0.4)
|
|
126
|
+
track_open_instances (~> 0.1)
|
|
127
|
+
pry (0.16.0)
|
|
128
|
+
coderay (~> 1.1)
|
|
129
|
+
method_source (~> 1.0)
|
|
130
|
+
reline (>= 0.6.0)
|
|
131
|
+
pstore (0.2.1)
|
|
132
|
+
public_suffix (7.0.5)
|
|
133
|
+
racc (1.8.1)
|
|
134
|
+
rainbow (3.1.1)
|
|
135
|
+
rake (13.4.2)
|
|
136
|
+
rb-fsevent (0.11.2)
|
|
137
|
+
rb-inotify (0.11.1)
|
|
138
|
+
ffi (~> 1.0)
|
|
139
|
+
rchardet (1.10.2)
|
|
140
|
+
regexp_parser (2.12.0)
|
|
141
|
+
reline (0.6.3)
|
|
142
|
+
io-console (~> 0.5)
|
|
143
|
+
rexml (3.4.4)
|
|
144
|
+
rspec (3.13.2)
|
|
145
|
+
rspec-core (~> 3.13.0)
|
|
146
|
+
rspec-expectations (~> 3.13.0)
|
|
147
|
+
rspec-mocks (~> 3.13.0)
|
|
148
|
+
rspec-core (3.13.6)
|
|
149
|
+
rspec-support (~> 3.13.0)
|
|
150
|
+
rspec-expectations (3.13.5)
|
|
151
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
152
|
+
rspec-support (~> 3.13.0)
|
|
153
|
+
rspec-mocks (3.13.8)
|
|
154
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
155
|
+
rspec-support (~> 3.13.0)
|
|
156
|
+
rspec-support (3.13.7)
|
|
157
|
+
rubocop (1.88.0)
|
|
158
|
+
json (~> 2.3)
|
|
159
|
+
language_server-protocol (~> 3.17.0.2)
|
|
160
|
+
lint_roller (~> 1.1.0)
|
|
161
|
+
parallel (>= 1.10)
|
|
162
|
+
parser (>= 3.3.0.2)
|
|
163
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
164
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
165
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
166
|
+
ruby-progressbar (~> 1.7)
|
|
167
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
168
|
+
rubocop-ast (1.49.1)
|
|
169
|
+
parser (>= 3.3.7.2)
|
|
170
|
+
prism (~> 1.7)
|
|
171
|
+
ruby-progressbar (1.13.0)
|
|
172
|
+
sawyer (0.9.3)
|
|
173
|
+
addressable (>= 2.3.5)
|
|
174
|
+
faraday (>= 0.17.3, < 3)
|
|
175
|
+
securerandom (0.4.1)
|
|
176
|
+
shellany (0.0.1)
|
|
177
|
+
simplecov (0.22.0)
|
|
178
|
+
docile (~> 1.1)
|
|
179
|
+
simplecov-html (~> 0.11)
|
|
180
|
+
simplecov_json_formatter (~> 0.1)
|
|
181
|
+
simplecov-html (0.13.2)
|
|
182
|
+
simplecov_json_formatter (0.1.4)
|
|
183
|
+
terminal-table (4.0.0)
|
|
184
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
185
|
+
thor (1.5.0)
|
|
186
|
+
track_open_instances (0.1.15)
|
|
187
|
+
tzinfo (2.0.6)
|
|
188
|
+
concurrent-ruby (~> 1.0)
|
|
189
|
+
unicode-display_width (3.2.0)
|
|
190
|
+
unicode-emoji (~> 4.1)
|
|
191
|
+
unicode-emoji (4.2.0)
|
|
192
|
+
uri (1.1.1)
|
|
193
|
+
|
|
194
|
+
PLATFORMS
|
|
195
|
+
x64-mingw-ucrt
|
|
196
|
+
|
|
197
|
+
DEPENDENCIES
|
|
198
|
+
danger-dart-linter!
|
|
199
|
+
guard-rspec (~> 4.7)
|
|
200
|
+
rake (~> 13.2)
|
|
201
|
+
rspec (~> 3.13)
|
|
202
|
+
rubocop (~> 1.88)
|
|
203
|
+
simplecov (~> 0.22)
|
|
204
|
+
|
|
205
|
+
CHECKSUMS
|
|
206
|
+
activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
|
|
207
|
+
addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
|
|
208
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
209
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
210
|
+
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
211
|
+
bundler (4.0.15) sha256=a4ceb882fe94a0e0ac63cd0813932bbfd631a14e5ac0b7975189b19a4d28d9e7
|
|
212
|
+
claide (1.1.0) sha256=6d3c5c089dde904d96aa30e73306d0d4bd444b1accb9b3125ce14a3c0183f82e
|
|
213
|
+
claide-plugins (0.9.2) sha256=c7ea78bc067ab23bce8515497cdcdcb8f01c86dadfbe13c44644e382922c1c2e
|
|
214
|
+
coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
|
|
215
|
+
colored2 (3.1.2) sha256=b13c2bd7eeae2cf7356a62501d398e72fde78780bd26aec6a979578293c28b4a
|
|
216
|
+
concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
|
|
217
|
+
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
218
|
+
cork (0.3.0) sha256=a0a0ac50e262f8514d1abe0a14e95e71c98b24e3378690e5d044daf0013ad4bc
|
|
219
|
+
danger (9.6.0) sha256=18dd35662d712fbc2e9ce0b757ae29ce6bcfacec3d3b1817206be07fddfa5fa2
|
|
220
|
+
danger-dart-linter (1.0.0)
|
|
221
|
+
danger-plugin-api (1.0.0) sha256=a0f3f4f2c19fbdfb41db6015fe8ed5eeb2588dc71f2f78d580294c2b10f83bd3
|
|
222
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
223
|
+
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
|
224
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
225
|
+
faraday (2.14.3) sha256=1882247e6766615c8220b4392bf1d27f6ebb63d8e28267587cef1fb0bf37f278
|
|
226
|
+
faraday-http-cache (2.7.0) sha256=cd7ac4bbe6c08592ea7af6655f98b2f76c4db0bad31bf40340df5aad719f0d89
|
|
227
|
+
faraday-net_http (3.4.4) sha256=0e78af151747ed1b00f33e25973b4bc220d7f16c00c39676817c8b12331eb588
|
|
228
|
+
ffi (1.17.4-x64-mingw-ucrt) sha256=f6ff9618cfccc494138bddade27aa06c74c6c7bc367a1ea1103d80c2fcb9ed35
|
|
229
|
+
formatador (1.2.3) sha256=19fa898133c2c26cdbb5d09f6998c1e137ad9427a046663e55adfe18b950d894
|
|
230
|
+
git (4.3.2) sha256=a3b0706573bb8cdd9edc630c33e2611ca5cbdece086f7c142bef73bc38522907
|
|
231
|
+
guard (2.20.1) sha256=ab9cd7873854e6b76080c0589f781ff3e390e441bdda20165804df54f977015a
|
|
232
|
+
guard-compat (1.2.1) sha256=3ad21ab0070107f92edfd82610b5cdc2fb8e368851e72362ada9703443d646fe
|
|
233
|
+
guard-rspec (4.7.3) sha256=a47ba03cbd1e3c71e6ae8645cea97e203098a248aede507461a43e906e2f75ca
|
|
234
|
+
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
|
|
235
|
+
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
236
|
+
json (2.20.0) sha256=9362bc6e55a952b056abf9167cf053358181c904cb70cd6eee0808ea830fc32b
|
|
237
|
+
kramdown (2.5.2) sha256=1ba542204c66b6f9111ff00dcc26075b95b220b07f2905d8261740c82f7f02fa
|
|
238
|
+
kramdown-parser-gfm (1.1.0) sha256=fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729
|
|
239
|
+
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
240
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
241
|
+
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
|
|
242
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
243
|
+
lumberjack (1.4.2) sha256=40de5ae46321380c835031bcc1370f13bba304d29f2b5f5bb152061a5a191b95
|
|
244
|
+
method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
|
|
245
|
+
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
|
|
246
|
+
nap (1.1.0) sha256=949691660f9d041d75be611bb2a8d2fd559c467537deac241f4097d9b5eea576
|
|
247
|
+
nenv (0.3.0) sha256=d9de6d8fb7072228463bf61843159419c969edb34b3cef51832b516ae7972765
|
|
248
|
+
net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
|
|
249
|
+
notiffany (0.1.3) sha256=d37669605b7f8dcb04e004e6373e2a780b98c776f8eb503ac9578557d7808738
|
|
250
|
+
octokit (10.0.0) sha256=82e99a539b7637b7e905e6d277bb0c1a4bed56735935cc33db6da7eae49a24e8
|
|
251
|
+
open4 (1.3.4) sha256=a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1
|
|
252
|
+
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
|
|
253
|
+
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
|
|
254
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
255
|
+
process_executer (4.0.4) sha256=6c179bd31b876e220e7a1ed30c8f8ee7333b9b5b4b8c301474b947b707c3ba6f
|
|
256
|
+
pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
|
|
257
|
+
pstore (0.2.1) sha256=03904d0f2c66579e96d1e6704cdabc0c88df7ea8ed8782d9f3569f6f6c702c1a
|
|
258
|
+
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
|
|
259
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
260
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
261
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
262
|
+
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
|
|
263
|
+
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
|
|
264
|
+
rchardet (1.10.2) sha256=e041cb195f464dc10e49ab130f78c8b5956cd9a4f4f6df84e0c183b87c135f33
|
|
265
|
+
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
|
|
266
|
+
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
267
|
+
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
|
|
268
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
269
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
270
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
271
|
+
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
272
|
+
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
273
|
+
rubocop (1.88.0) sha256=e420ddf1662d0ef34bc8a2910ac4b396a7ddda0b51a708264405241734b08e0b
|
|
274
|
+
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
|
|
275
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
276
|
+
sawyer (0.9.3) sha256=0d0f19298408047037638639fe62f4794483fb04320269169bd41af2bdcf5e41
|
|
277
|
+
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
278
|
+
shellany (0.0.1) sha256=0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7
|
|
279
|
+
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
|
|
280
|
+
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
|
|
281
|
+
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
|
|
282
|
+
terminal-table (4.0.0) sha256=f504793203f8251b2ea7c7068333053f0beeea26093ec9962e62ea79f94301d2
|
|
283
|
+
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
|
284
|
+
track_open_instances (0.1.15) sha256=7f0e48821e6b4c881daaa40fb1583e308937c22a9c84883c150b399c3b5c3029
|
|
285
|
+
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
|
|
286
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
287
|
+
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
288
|
+
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
289
|
+
|
|
290
|
+
BUNDLED WITH
|
|
291
|
+
4.0.15
|
data/Guardfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
|
2
|
+
require "guard/rspec/dsl"
|
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
4
|
+
|
|
5
|
+
# RSpec files
|
|
6
|
+
rspec = dsl.rspec
|
|
7
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
8
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
9
|
+
watch(rspec.spec_files)
|
|
10
|
+
|
|
11
|
+
# Ruby files
|
|
12
|
+
ruby = dsl.ruby
|
|
13
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
14
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fasunna
|
|
4
|
+
Copyright (c) 2019 Mateusz Szklarek
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Danger Dart Linter
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/danger-dart-linter)
|
|
4
|
+
<!-- [](https://travis-ci.org/<username>/danger-dart-linter)
|
|
5
|
+
[](https://codecov.io/gh/<username>/danger-dart-linter) -->
|
|
6
|
+
|
|
7
|
+
A Danger Plugin to lint dart files using `dart analyze` command line interface.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
$ gem 'danger-dart-linter'
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install danger-dart-linter
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Dart Analyze doesn't give an option to generate report but you can achieve this easily using regular shell command (locally or on CI):
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
$ dart analyze > dart_analyze_report.txt
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
It will add output from `dart analyze` command to `dart_analyze_report.txt`.
|
|
28
|
+
|
|
29
|
+
Now you need to set `report_path` and invoke `lint` in your Dangerfile.
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
dart_linter.report_path = "dart_analyze_report.txt"
|
|
33
|
+
dart_linter.lint
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This will add markdown table with summary into your PR.
|
|
37
|
+
|
|
38
|
+
Or make Danger comment directly on the line instead of printing a Markdown table (GitHub only)
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
dart_linter.lint(inline_mode: true)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Default value for `inline_mode` parameter is false.
|
|
45
|
+
|
|
46
|
+
#### Lint only added/modified files
|
|
47
|
+
|
|
48
|
+
If you're dealing with a legacy project, with tons of warnings, you may want to lint only new/modified files. You can easily achieve that, setting the `only_modified_files` parameter to `true`.
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
dart_linter.only_modified_files = true
|
|
52
|
+
dart_linter.report_path = "dart_analyze_report.txt"
|
|
53
|
+
dart_linter.lint
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
1. Clone this repo
|
|
59
|
+
2. Run `gem install bundler` to configure environment tools.
|
|
60
|
+
3. Run `bundle install` to setup dependencies.
|
|
61
|
+
4. Run `bundle exec rake spec` to run the tests.
|
|
62
|
+
5. Use `bundle exec guard` to automatically have tests run as you make changes.
|
|
63
|
+
6. Make your changes.
|
|
64
|
+
|
|
65
|
+
## Contributing
|
|
66
|
+
|
|
67
|
+
Merge requests are welcome on GitLab at https://gitlab.com/fasunna/danger-dart-linter.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
72
|
+
|
|
73
|
+
**⚠️ Disclaimer:** This project is a copy and continuation of [danger-flutter_lint](https://github.com/mateuszszklarek/danger-flutter_lint) by [mateuszszklarek](https://github.com/mateuszszklarek). All original work belongs to the author.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
require "rubocop/rake_task"
|
|
4
|
+
|
|
5
|
+
RSpec::Core::RakeTask.new(:specs)
|
|
6
|
+
|
|
7
|
+
task default: :specs
|
|
8
|
+
|
|
9
|
+
task :spec do
|
|
10
|
+
Rake::Task["specs"].invoke
|
|
11
|
+
Rake::Task["rubocop"].invoke
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "Run RuboCop on the lib/specs directory"
|
|
15
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
|
16
|
+
task.patterns = ["lib/**/*.rb"]
|
|
17
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require "dart_linter/gem_version.rb"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "danger-dart-linter"
|
|
7
|
+
spec.version = DartLinter::VERSION
|
|
8
|
+
spec.authors = ["fasunna"]
|
|
9
|
+
spec.email = ["2161017-fasunna@users.noreply.gitlab.com"]
|
|
10
|
+
spec.summary = "A Danger Plugin to lint dart files using dart analyze command line interface."
|
|
11
|
+
spec.homepage = "https://gitlab.com/fasunna/danger-dart-linter"
|
|
12
|
+
spec.license = "MIT"
|
|
13
|
+
|
|
14
|
+
spec.required_ruby_version = ">=3.0"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
|
24
|
+
spec.add_development_dependency "rake", "~> 13.2"
|
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
|
26
|
+
spec.add_development_dependency "rubocop", "~> 1.88"
|
|
27
|
+
spec.add_development_dependency "simplecov", "~> 0.22"
|
|
28
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "dart_linter/gem_version"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "dart_linter/plugin"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
DartViolation = Struct.new(:level, :rule, :description, :file, :line)
|
|
2
|
+
|
|
3
|
+
class DartAnalyzeParser
|
|
4
|
+
class << self
|
|
5
|
+
def violations(input)
|
|
6
|
+
filtered_input = filter_input(input)
|
|
7
|
+
|
|
8
|
+
return [] if filtered_input.detect { |element| element.include? "No issues found!" }
|
|
9
|
+
|
|
10
|
+
# Check if the line starts with error, warning or info
|
|
11
|
+
level_pattern = /^(?:error|warning|info)/
|
|
12
|
+
|
|
13
|
+
filtered_input
|
|
14
|
+
.select { |line| line.match?(level_pattern) }
|
|
15
|
+
.map(&method(:parse_line))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def filter_input(input)
|
|
21
|
+
input.each_line
|
|
22
|
+
.map(&:strip)
|
|
23
|
+
.reject(&:empty?)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def parse_line(line)
|
|
27
|
+
level, file_with_line_number, description, rule = line.split(" • ")
|
|
28
|
+
file, line = file_with_line_number.split(":")
|
|
29
|
+
|
|
30
|
+
DartViolation.new(level, rule, description, file, line.to_i)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require_relative "dart_analyze_parser"
|
|
2
|
+
|
|
3
|
+
module Danger
|
|
4
|
+
class DangerDartLinter < Plugin
|
|
5
|
+
# Enable only_modified_files
|
|
6
|
+
# Only show messages within changed files.
|
|
7
|
+
attr_accessor :only_modified_files
|
|
8
|
+
|
|
9
|
+
# Report path
|
|
10
|
+
# You should set output from `dart analyze` here
|
|
11
|
+
attr_accessor :report_path
|
|
12
|
+
|
|
13
|
+
def lint(inline_mode: false)
|
|
14
|
+
if dart_exists?
|
|
15
|
+
lint_if_report_exists(inline_mode: inline_mode)
|
|
16
|
+
else
|
|
17
|
+
fail("Could not find `dart` inside current directory")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def lint_if_report_exists(inline_mode:)
|
|
24
|
+
if !report_path.nil? && File.exist?(report_path)
|
|
25
|
+
report = File.open(report_path)
|
|
26
|
+
violations = DartAnalyzeParser.violations(report)
|
|
27
|
+
lint_mode(inline_mode: inline_mode, violations: violations)
|
|
28
|
+
else
|
|
29
|
+
fail("Could not run lint without setting report path or report file doesn't exists")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def lint_mode(inline_mode:, violations:)
|
|
34
|
+
if inline_mode
|
|
35
|
+
send_inline_comments(violations)
|
|
36
|
+
else
|
|
37
|
+
markdown(summary_table(violations))
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def send_inline_comments(violations)
|
|
42
|
+
filtered_violations = filtered_violations(violations)
|
|
43
|
+
|
|
44
|
+
filtered_violations.each do |violation|
|
|
45
|
+
send("warn", violation.description, file: violation.file, line: violation.line)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def summary_table(violations)
|
|
50
|
+
filtered_violations = filtered_violations(violations)
|
|
51
|
+
|
|
52
|
+
if filtered_violations.empty?
|
|
53
|
+
return "### Dart Analyze found #{filtered_violations.length} issues ✅"
|
|
54
|
+
else
|
|
55
|
+
return markdown_table(filtered_violations)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def markdown_table(violations)
|
|
60
|
+
table = "### Dart Analyze found #{violations.length} issues ❌\n\n"
|
|
61
|
+
table << "| Level | File | Line | Rule |\n"
|
|
62
|
+
table << "| ----- | ---- | ---- | ---- |\n"
|
|
63
|
+
|
|
64
|
+
return violations.reduce(table) { |acc, violation| acc << table_row(violation) }
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def level_icon(level)
|
|
68
|
+
case level
|
|
69
|
+
when "info" then "ℹ️"
|
|
70
|
+
when "warning" then "⚠️"
|
|
71
|
+
when "error" then "⛔"
|
|
72
|
+
else ""
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def table_row(violation)
|
|
77
|
+
"| #{level_icon(violation.level)} | `#{violation.file}` | #{violation.line} | #{violation.rule} |\n"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def filtered_violations(violations)
|
|
81
|
+
target_files = (git.modified_files - git.deleted_files) + git.added_files
|
|
82
|
+
filtered_violations = violations.select { |violation| target_files.include? violation.file }
|
|
83
|
+
|
|
84
|
+
return only_modified_files ? filtered_violations : violations
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def dart_exists?
|
|
88
|
+
`command -v dart`.strip.empty? == false
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
require File.expand_path("spec_helper", __dir__)
|
|
2
|
+
|
|
3
|
+
module Danger
|
|
4
|
+
describe Danger::DangerDartLinter do
|
|
5
|
+
it "should be a danger plugin" do
|
|
6
|
+
expect(Danger::DangerDartLinter.new(nil)).to be_a Danger::Plugin
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe "with a Dangerfile" do
|
|
10
|
+
before do
|
|
11
|
+
@dangerfile = testing_dangerfile
|
|
12
|
+
@dart_linter = @dangerfile.dart_linter
|
|
13
|
+
allow(@dart_linter.git).to receive(:deleted_files).and_return([])
|
|
14
|
+
allow(@dart_linter.git).to receive(:added_files).and_return([])
|
|
15
|
+
allow(@dart_linter.git).to receive(:modified_files).and_return([
|
|
16
|
+
"lib/home/home_page.dart",
|
|
17
|
+
"lib/profile/user/phone_widget.dart"
|
|
18
|
+
])
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context "when dart is not installed" do
|
|
22
|
+
before do
|
|
23
|
+
allow(@dart_linter).to receive(:`).with("command -v dart").and_return("")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should fail when lint" do
|
|
27
|
+
@dart_linter.lint
|
|
28
|
+
|
|
29
|
+
expect(@dart_linter.status_report[:errors]).to eq(["Could not find `dart` inside current directory"])
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context "when dart is installed and report is not set" do
|
|
34
|
+
before do
|
|
35
|
+
allow(@dart_linter).to receive(:`).with("command -v dart").and_return("/Users/johndoe/.dart/bin/dart")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should fail when lint" do
|
|
39
|
+
@dart_linter.lint
|
|
40
|
+
|
|
41
|
+
expect(@dart_linter.status_report[:errors]).to eq(["Could not run lint without setting report path or report file doesn't exists"])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
context "when report is set but file not exists" do
|
|
45
|
+
before do
|
|
46
|
+
allow(@dart_linter).to receive(:`).with("command -v dart").and_return("/Users/johndoe/.dart/bin/dart")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should fail when lint" do
|
|
50
|
+
@dart_linter.report_path = "users/johndoe/invalid_path/report.txt"
|
|
51
|
+
@dart_linter.lint
|
|
52
|
+
|
|
53
|
+
expect(@dart_linter.status_report[:errors]).to eq(["Could not run lint without setting report path or report file doesn't exists"])
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context "when set `dart analyze` report path without violations" do
|
|
58
|
+
before do
|
|
59
|
+
@dart_linter.report_path = "spec/fixtures/dart_analyze_without_violations.txt"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "should NOT fail when lint" do
|
|
63
|
+
@dart_linter.lint
|
|
64
|
+
|
|
65
|
+
expect(@dart_linter.status_report[:errors]).to be_empty
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "should add markdown message with 0 violations when inline mode is off" do
|
|
69
|
+
@dart_linter.lint(inline_mode: false)
|
|
70
|
+
|
|
71
|
+
markdown = @dart_linter.status_report[:markdowns].first.message
|
|
72
|
+
expect(markdown).to eq("### Dart Analyze found 0 issues ✅")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "should NOT print markdown message when inline mode is on" do
|
|
76
|
+
@dart_linter.lint(inline_mode: true)
|
|
77
|
+
|
|
78
|
+
markdown = @dart_linter.status_report[:markdowns]
|
|
79
|
+
expect(markdown).to be_empty
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
context "when set `dart analyze` report with some violations" do
|
|
84
|
+
before do
|
|
85
|
+
@dart_linter.report_path = "spec/fixtures/dart_analyze_with_violations.txt"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "should NOT fail when lint" do
|
|
89
|
+
@dart_linter.lint
|
|
90
|
+
|
|
91
|
+
expect(@dart_linter.status_report[:errors]).to be_empty
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it "should print markdown message with 5 violations when inline mode is off & only_modified_files not set" do
|
|
95
|
+
@dart_linter.lint(inline_mode: false)
|
|
96
|
+
|
|
97
|
+
expected = <<~MESSAGE
|
|
98
|
+
### Dart Analyze found 5 issues ❌\n
|
|
99
|
+
| Level | File | Line | Rule |
|
|
100
|
+
| ----- | ---- | ---- | ---- |
|
|
101
|
+
| ⛔ | `lib/main.dart` | 2 | non_abstract_class_inherits_abstract_member |
|
|
102
|
+
| ⚠️ | `lib/main.dart` | 3 | override_on_non_overriding_member |
|
|
103
|
+
| ℹ️ | `lib/main.dart` | 5 | camel_case_types |
|
|
104
|
+
| ℹ️ | `lib/home/home_page.dart` | 13 | prefer_const_constructors |
|
|
105
|
+
| ℹ️ | `lib/profile/user/phone_widget.dart` | 19 | avoid_catches_without_on_clauses |
|
|
106
|
+
MESSAGE
|
|
107
|
+
|
|
108
|
+
expect(@dart_linter.status_report[:markdowns].first.message).to eq(expected)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "should send 5 inline comment instead of markdown when inline mode is on & only_modified_files not set" do
|
|
112
|
+
@dart_linter.lint(inline_mode: true)
|
|
113
|
+
|
|
114
|
+
warnings = @dart_linter.status_report[:warnings]
|
|
115
|
+
|
|
116
|
+
exepcted_warnings = [
|
|
117
|
+
"Missing concrete implementation of Xpto",
|
|
118
|
+
"The method doesn't override an inherited method",
|
|
119
|
+
"Name types using UpperCamelCase",
|
|
120
|
+
"Prefer const with constant constructors",
|
|
121
|
+
"AVOID catches without on clauses"
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
expect(warnings).to eq(exepcted_warnings)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "should print markdown message with 2 violations when inline mode is off & only_modified_files set to true" do
|
|
128
|
+
@dart_linter.only_modified_files = true
|
|
129
|
+
@dart_linter.lint(inline_mode: false)
|
|
130
|
+
|
|
131
|
+
expected = <<~MESSAGE
|
|
132
|
+
### Dart Analyze found 2 issues ❌\n
|
|
133
|
+
| Level | File | Line | Rule |
|
|
134
|
+
| ----- | ---- | ---- | ---- |
|
|
135
|
+
| ℹ️ | `lib/home/home_page.dart` | 13 | prefer_const_constructors |
|
|
136
|
+
| ℹ️ | `lib/profile/user/phone_widget.dart` | 19 | avoid_catches_without_on_clauses |
|
|
137
|
+
MESSAGE
|
|
138
|
+
|
|
139
|
+
expect(@dart_linter.status_report[:markdowns].first.message).to eq(expected)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it "should send 2 inline comment instead of markdown when inline mode is on & only_modified_files set to true" do
|
|
143
|
+
@dart_linter.only_modified_files = true
|
|
144
|
+
@dart_linter.lint(inline_mode: true)
|
|
145
|
+
|
|
146
|
+
warnings = @dart_linter.status_report[:warnings]
|
|
147
|
+
|
|
148
|
+
exepcted_warnings = [
|
|
149
|
+
"Prefer const with constant constructors",
|
|
150
|
+
"AVOID catches without on clauses"
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
expect(warnings).to eq(exepcted_warnings)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
Analyzing my_flutter_project...
|
|
3
|
+
|
|
4
|
+
error • lib/main.dart:2:6 • Missing concrete implementation of Xpto • non_abstract_class_inherits_abstract_member
|
|
5
|
+
warning • lib/main.dart:3:4 • The method doesn't override an inherited method • override_on_non_overriding_member
|
|
6
|
+
info • lib/main.dart:5:7 • Name types using UpperCamelCase • camel_case_types
|
|
7
|
+
info • lib/home/home_page.dart:13:13 • Prefer const with constant constructors • prefer_const_constructors
|
|
8
|
+
info • lib/profile/user/phone_widget.dart:19:7 • AVOID catches without on clauses • avoid_catches_without_on_clauses
|
|
9
|
+
|
|
10
|
+
5 issues found.
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require "pathname"
|
|
2
|
+
ROOT = Pathname.new(File.expand_path("..", __dir__))
|
|
3
|
+
$:.unshift((ROOT + "lib").to_s)
|
|
4
|
+
$:.unshift((ROOT + "spec").to_s)
|
|
5
|
+
|
|
6
|
+
require "simplecov"
|
|
7
|
+
SimpleCov.start
|
|
8
|
+
|
|
9
|
+
if ENV["CI"] == "true"
|
|
10
|
+
require "codecov"
|
|
11
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
require "bundler/setup"
|
|
15
|
+
|
|
16
|
+
require "rspec"
|
|
17
|
+
require "danger"
|
|
18
|
+
require "danger_plugin"
|
|
19
|
+
|
|
20
|
+
RSpec.configure do |config|
|
|
21
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
|
22
|
+
config.filter_gems_from_backtrace "bundler"
|
|
23
|
+
config.expect_with :rspec do |c|
|
|
24
|
+
c.syntax = :expect
|
|
25
|
+
end
|
|
26
|
+
config.color = true
|
|
27
|
+
config.tty = true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
def testing_env
|
|
32
|
+
{
|
|
33
|
+
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
|
|
34
|
+
"TRAVIS_PULL_REQUEST" => "800",
|
|
35
|
+
"TRAVIS_REPO_SLUG" => "artsy/eigen",
|
|
36
|
+
"TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
|
|
37
|
+
"DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def testing_ui
|
|
42
|
+
@output = StringIO.new
|
|
43
|
+
def @output.winsize
|
|
44
|
+
[20, 9999]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
cork = Cork::Board.new(out: @output)
|
|
48
|
+
def cork.string
|
|
49
|
+
out.string.gsub(/\e\[([;\d]+)?m/, "")
|
|
50
|
+
end
|
|
51
|
+
cork
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def testing_dangerfile
|
|
55
|
+
env = Danger::EnvironmentManager.new(testing_env)
|
|
56
|
+
Danger::Dangerfile.new(env, testing_ui)
|
|
57
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: danger-dart-linter
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- fasunna
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: danger-plugin-api
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: guard-rspec
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '4.7'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '4.7'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rake
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '13.2'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '13.2'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rspec
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '3.13'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '3.13'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rubocop
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.88'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.88'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: simplecov
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0.22'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0.22'
|
|
96
|
+
email:
|
|
97
|
+
- 2161017-fasunna@users.noreply.gitlab.com
|
|
98
|
+
executables: []
|
|
99
|
+
extensions: []
|
|
100
|
+
extra_rdoc_files: []
|
|
101
|
+
files:
|
|
102
|
+
- ".gitignore"
|
|
103
|
+
- ".rspec"
|
|
104
|
+
- ".rubocop.yml"
|
|
105
|
+
- ".travis.yml"
|
|
106
|
+
- Gemfile
|
|
107
|
+
- Gemfile.lock
|
|
108
|
+
- Guardfile
|
|
109
|
+
- LICENSE.txt
|
|
110
|
+
- README.md
|
|
111
|
+
- Rakefile
|
|
112
|
+
- danger-dart-linter.gemspec
|
|
113
|
+
- lib/danger_dart_linter.rb
|
|
114
|
+
- lib/danger_plugin.rb
|
|
115
|
+
- lib/dart_linter/dart_analyze_parser.rb
|
|
116
|
+
- lib/dart_linter/gem_version.rb
|
|
117
|
+
- lib/dart_linter/plugin.rb
|
|
118
|
+
- spec/dart_lint_spec.rb
|
|
119
|
+
- spec/fixtures/dart_analyze_with_violations.txt
|
|
120
|
+
- spec/fixtures/dart_analyze_without_violations.txt
|
|
121
|
+
- spec/spec_helper.rb
|
|
122
|
+
homepage: https://gitlab.com/fasunna/danger-dart-linter
|
|
123
|
+
licenses:
|
|
124
|
+
- MIT
|
|
125
|
+
metadata: {}
|
|
126
|
+
rdoc_options: []
|
|
127
|
+
require_paths:
|
|
128
|
+
- lib
|
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - ">="
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '3.0'
|
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
requirements: []
|
|
140
|
+
rubygems_version: 3.6.9
|
|
141
|
+
specification_version: 4
|
|
142
|
+
summary: A Danger Plugin to lint dart files using dart analyze command line interface.
|
|
143
|
+
test_files:
|
|
144
|
+
- spec/dart_lint_spec.rb
|
|
145
|
+
- spec/fixtures/dart_analyze_with_violations.txt
|
|
146
|
+
- spec/fixtures/dart_analyze_without_violations.txt
|
|
147
|
+
- spec/spec_helper.rb
|