danger-periphery 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger_plugin.rb +51 -29
- data/lib/periphery/checkstyle_parser.rb +12 -16
- data/lib/periphery/runner.rb +15 -18
- data/lib/periphery.rb +2 -2
- data/lib/version.rb +1 -1
- metadata +3 -26
- data/.github/workflows/lint.yml +0 -12
- data/.github/workflows/test.yml +0 -10
- data/.gitignore +0 -9
- data/.rspec +0 -3
- data/.rubocop.yml +0 -338
- data/Dangerfile +0 -14
- data/Gemfile +0 -17
- data/Gemfile.lock +0 -178
- data/Guardfile +0 -48
- data/LICENSE.txt +0 -22
- data/README.md +0 -106
- data/Rakefile +0 -19
- data/bin/download_periphery +0 -7
- data/danger-periphery.gemspec +0 -24
- data/spec/danger_plugin_spec.rb +0 -195
- data/spec/periphery/checkstyle_parser_spec.rb +0 -34
- data/spec/periphery/runner_spec.rb +0 -116
- data/spec/spec_helper.rb +0 -83
- data/spec/support/fixtures/github_pr.json +0 -381
- data/spec/support/fixtures/mock-periphery +0 -18
- data/spec/support/fixtures/test/main.swift +0 -23
- data/spec/support/fixtures/test.xcodeproj/project.pbxproj +0 -286
data/.rubocop.yml
DELETED
@@ -1,338 +0,0 @@
|
|
1
|
-
# Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
-
|
3
|
-
# If you don't like these settings, just delete this file :)
|
4
|
-
|
5
|
-
AllCops:
|
6
|
-
TargetRubyVersion: 2.6
|
7
|
-
SuggestExtensions: false
|
8
|
-
|
9
|
-
Style/StringLiterals:
|
10
|
-
EnforcedStyle: double_quotes
|
11
|
-
Enabled: true
|
12
|
-
|
13
|
-
# kind_of? is a good way to check a type
|
14
|
-
Style/ClassCheck:
|
15
|
-
EnforcedStyle: kind_of?
|
16
|
-
|
17
|
-
# specs sometimes have useless assignments, which is fine
|
18
|
-
Lint/UselessAssignment:
|
19
|
-
Exclude:
|
20
|
-
- '**/spec/**/*'
|
21
|
-
|
22
|
-
# We could potentially enable the 2 below:
|
23
|
-
Layout/FirstHashElementIndentation:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Layout/HashAlignment:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
# HoundCI doesn't like this rule
|
30
|
-
Layout/DotPosition:
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
# We allow !! as it's an easy way to convert ot boolean
|
34
|
-
Style/DoubleNegation:
|
35
|
-
Enabled: false
|
36
|
-
|
37
|
-
# Cop supports --auto-correct.
|
38
|
-
Lint/UnusedBlockArgument:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
# We want to allow class Fastlane::Class
|
42
|
-
Style/ClassAndModuleChildren:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Metrics/AbcSize:
|
46
|
-
Max: 60
|
47
|
-
|
48
|
-
# The %w might be confusing for new users
|
49
|
-
Style/WordArray:
|
50
|
-
MinSize: 19
|
51
|
-
|
52
|
-
# raise and fail are both okay
|
53
|
-
Style/SignalException:
|
54
|
-
Enabled: false
|
55
|
-
|
56
|
-
# Better too much 'return' than one missing
|
57
|
-
Style/RedundantReturn:
|
58
|
-
Enabled: false
|
59
|
-
|
60
|
-
# Having if in the same line might not always be good
|
61
|
-
Style/IfUnlessModifier:
|
62
|
-
Enabled: false
|
63
|
-
|
64
|
-
# and and or is okay
|
65
|
-
Style/AndOr:
|
66
|
-
Enabled: false
|
67
|
-
|
68
|
-
# Configuration parameters: CountComments.
|
69
|
-
Metrics/ClassLength:
|
70
|
-
Max: 350
|
71
|
-
|
72
|
-
Metrics/CyclomaticComplexity:
|
73
|
-
Max: 17
|
74
|
-
|
75
|
-
# Configuration parameters: AllowURI, URISchemes.
|
76
|
-
Layout/LineLength:
|
77
|
-
Max: 370
|
78
|
-
|
79
|
-
# Configuration parameters: CountKeywordArgs.
|
80
|
-
Metrics/ParameterLists:
|
81
|
-
Max: 10
|
82
|
-
|
83
|
-
Metrics/PerceivedComplexity:
|
84
|
-
Max: 18
|
85
|
-
|
86
|
-
# Sometimes it's easier to read without guards
|
87
|
-
Style/GuardClause:
|
88
|
-
Enabled: false
|
89
|
-
|
90
|
-
# something = if something_else
|
91
|
-
# that's confusing
|
92
|
-
Style/ConditionalAssignment:
|
93
|
-
Enabled: false
|
94
|
-
|
95
|
-
# Better to have too much self than missing a self
|
96
|
-
Style/RedundantSelf:
|
97
|
-
Enabled: false
|
98
|
-
|
99
|
-
Metrics/MethodLength:
|
100
|
-
Max: 60
|
101
|
-
|
102
|
-
# We're not there yet
|
103
|
-
Style/Documentation:
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
# Adds complexity
|
107
|
-
Style/IfInsideElse:
|
108
|
-
Enabled: false
|
109
|
-
|
110
|
-
# danger specific
|
111
|
-
|
112
|
-
Style/BlockComments:
|
113
|
-
Enabled: false
|
114
|
-
|
115
|
-
Layout/MultilineMethodCallIndentation:
|
116
|
-
EnforcedStyle: indented
|
117
|
-
|
118
|
-
# FIXME: 25
|
119
|
-
Metrics/BlockLength:
|
120
|
-
Max: 345
|
121
|
-
Exclude:
|
122
|
-
- "**/*_spec.rb"
|
123
|
-
|
124
|
-
Style/MixinGrouping:
|
125
|
-
Enabled: false
|
126
|
-
|
127
|
-
Naming/BlockForwarding:
|
128
|
-
Enabled: true
|
129
|
-
|
130
|
-
Naming/FileName:
|
131
|
-
Enabled: false
|
132
|
-
|
133
|
-
Layout/HeredocIndentation:
|
134
|
-
Enabled: false
|
135
|
-
|
136
|
-
Style/SpecialGlobalVars:
|
137
|
-
Enabled: false
|
138
|
-
|
139
|
-
Style/PercentLiteralDelimiters:
|
140
|
-
PreferredDelimiters:
|
141
|
-
"%": ()
|
142
|
-
"%i": ()
|
143
|
-
"%q": ()
|
144
|
-
"%Q": ()
|
145
|
-
"%r": "{}"
|
146
|
-
"%s": ()
|
147
|
-
"%w": ()
|
148
|
-
"%W": ()
|
149
|
-
"%x": ()
|
150
|
-
|
151
|
-
Security/CompoundHash:
|
152
|
-
Enabled: true
|
153
|
-
|
154
|
-
Security/YAMLLoad:
|
155
|
-
Enabled: false
|
156
|
-
|
157
|
-
Gemspec/DeprecatedAttributeAssignment:
|
158
|
-
Enabled: true
|
159
|
-
|
160
|
-
Gemspec/RequireMFA:
|
161
|
-
Enabled: true
|
162
|
-
|
163
|
-
Layout/LineContinuationLeadingSpace:
|
164
|
-
Enabled: true
|
165
|
-
|
166
|
-
Layout/LineContinuationSpacing:
|
167
|
-
Enabled: true
|
168
|
-
|
169
|
-
Layout/LineEndStringConcatenationIndentation:
|
170
|
-
Enabled: true
|
171
|
-
|
172
|
-
Layout/SpaceBeforeBrackets:
|
173
|
-
Enabled: true
|
174
|
-
|
175
|
-
Lint/AmbiguousAssignment:
|
176
|
-
Enabled: true
|
177
|
-
|
178
|
-
Lint/AmbiguousOperatorPrecedence:
|
179
|
-
Enabled: true
|
180
|
-
|
181
|
-
Lint/AmbiguousRange:
|
182
|
-
Enabled: true
|
183
|
-
|
184
|
-
Lint/ConstantOverwrittenInRescue:
|
185
|
-
Enabled: true
|
186
|
-
|
187
|
-
Lint/DeprecatedConstants:
|
188
|
-
Enabled: true
|
189
|
-
|
190
|
-
Lint/DuplicateBranch:
|
191
|
-
Enabled: true
|
192
|
-
|
193
|
-
Lint/DuplicateRegexpCharacterClassElement:
|
194
|
-
Enabled: true
|
195
|
-
|
196
|
-
Lint/EmptyBlock:
|
197
|
-
Enabled: true
|
198
|
-
|
199
|
-
Lint/EmptyClass:
|
200
|
-
Enabled: true
|
201
|
-
|
202
|
-
Lint/EmptyInPattern:
|
203
|
-
Enabled: true
|
204
|
-
|
205
|
-
Lint/IncompatibleIoSelectWithFiberScheduler:
|
206
|
-
Enabled: true
|
207
|
-
|
208
|
-
Lint/LambdaWithoutLiteralBlock:
|
209
|
-
Enabled: true
|
210
|
-
|
211
|
-
Lint/NonAtomicFileOperation:
|
212
|
-
Enabled: true
|
213
|
-
|
214
|
-
Lint/NoReturnInBeginEndBlocks:
|
215
|
-
Enabled: true
|
216
|
-
|
217
|
-
Lint/NumberedParameterAssignment:
|
218
|
-
Enabled: true
|
219
|
-
|
220
|
-
Lint/OrAssignmentToConstant:
|
221
|
-
Enabled: true
|
222
|
-
|
223
|
-
Lint/RedundantDirGlobSort:
|
224
|
-
Enabled: true
|
225
|
-
|
226
|
-
Lint/RefinementImportMethods:
|
227
|
-
Enabled: true
|
228
|
-
|
229
|
-
Lint/RequireRelativeSelfPath:
|
230
|
-
Enabled: true
|
231
|
-
|
232
|
-
Lint/SymbolConversion:
|
233
|
-
Enabled: true
|
234
|
-
|
235
|
-
Lint/ToEnumArguments:
|
236
|
-
Enabled: true
|
237
|
-
|
238
|
-
Lint/TripleQuotes:
|
239
|
-
Enabled: true
|
240
|
-
|
241
|
-
Lint/UnexpectedBlockArity:
|
242
|
-
Enabled: true
|
243
|
-
|
244
|
-
Lint/UnmodifiedReduceAccumulator:
|
245
|
-
Enabled: true
|
246
|
-
|
247
|
-
Lint/UselessRuby2Keywords:
|
248
|
-
Enabled: true
|
249
|
-
|
250
|
-
Security/IoMethods:
|
251
|
-
Enabled: true
|
252
|
-
|
253
|
-
Style/ArgumentsForwarding:
|
254
|
-
Enabled: true
|
255
|
-
|
256
|
-
Style/CollectionCompact:
|
257
|
-
Enabled: true
|
258
|
-
|
259
|
-
Style/DocumentDynamicEvalDefinition:
|
260
|
-
Enabled: true
|
261
|
-
|
262
|
-
Style/EndlessMethod:
|
263
|
-
Enabled: true
|
264
|
-
|
265
|
-
Style/EnvHome:
|
266
|
-
Enabled: true
|
267
|
-
|
268
|
-
Style/FetchEnvVar:
|
269
|
-
Enabled: true
|
270
|
-
|
271
|
-
Style/FileRead:
|
272
|
-
Enabled: true
|
273
|
-
|
274
|
-
Style/FileWrite:
|
275
|
-
Enabled: true
|
276
|
-
|
277
|
-
Style/HashConversion:
|
278
|
-
Enabled: true
|
279
|
-
|
280
|
-
Style/HashExcept:
|
281
|
-
Enabled: true
|
282
|
-
|
283
|
-
Style/IfWithBooleanLiteralBranches:
|
284
|
-
Enabled: true
|
285
|
-
|
286
|
-
Style/InPatternThen:
|
287
|
-
Enabled: true
|
288
|
-
|
289
|
-
Style/MapCompactWithConditionalBlock:
|
290
|
-
Enabled: true
|
291
|
-
|
292
|
-
Style/MapToHash:
|
293
|
-
Enabled: true
|
294
|
-
|
295
|
-
Style/MultilineInPatternThen:
|
296
|
-
Enabled: true
|
297
|
-
|
298
|
-
Style/NegatedIfElseCondition:
|
299
|
-
Enabled: true
|
300
|
-
|
301
|
-
Style/NestedFileDirname:
|
302
|
-
Enabled: true
|
303
|
-
|
304
|
-
Style/NilLambda:
|
305
|
-
Enabled: true
|
306
|
-
|
307
|
-
Style/NumberedParameters:
|
308
|
-
Enabled: true
|
309
|
-
|
310
|
-
Style/NumberedParametersLimit:
|
311
|
-
Enabled: true
|
312
|
-
|
313
|
-
Style/ObjectThen:
|
314
|
-
Enabled: true
|
315
|
-
|
316
|
-
Style/OpenStructUse:
|
317
|
-
Enabled: true
|
318
|
-
|
319
|
-
Style/QuotedSymbols:
|
320
|
-
Enabled: true
|
321
|
-
|
322
|
-
Style/RedundantArgument:
|
323
|
-
Enabled: true
|
324
|
-
|
325
|
-
Style/RedundantInitialize:
|
326
|
-
Enabled: true
|
327
|
-
|
328
|
-
Style/RedundantSelfAssignmentBranch:
|
329
|
-
Enabled: true
|
330
|
-
|
331
|
-
Style/SelectByRegexp:
|
332
|
-
Enabled: true
|
333
|
-
|
334
|
-
Style/StringChars:
|
335
|
-
Enabled: true
|
336
|
-
|
337
|
-
Style/SwapValues:
|
338
|
-
Enabled: true
|
data/Dangerfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
rubocop.lint inline_comment: true
|
4
|
-
|
5
|
-
periphery.binary_path = "bin/periphery"
|
6
|
-
periphery.process_warnings do |path, line, column, message|
|
7
|
-
!message.match(/unused/i)
|
8
|
-
end
|
9
|
-
|
10
|
-
periphery.scan(
|
11
|
-
project: "spec/support/fixtures/test.xcodeproj",
|
12
|
-
schemes: "test",
|
13
|
-
targets: "test"
|
14
|
-
)
|
data/Gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
gem "bundler", "~> 2.0"
|
8
|
-
gem "danger"
|
9
|
-
gem "danger-rubocop"
|
10
|
-
gem "guard"
|
11
|
-
gem "guard-rspec"
|
12
|
-
gem "listen"
|
13
|
-
gem "pry"
|
14
|
-
gem "rake"
|
15
|
-
gem "rspec"
|
16
|
-
gem "rubocop"
|
17
|
-
gem "yard"
|
data/Gemfile.lock
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
danger-periphery (0.2.0)
|
5
|
-
danger-plugin-api (~> 1.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.8.0)
|
11
|
-
public_suffix (>= 2.0.2, < 5.0)
|
12
|
-
ast (2.4.2)
|
13
|
-
claide (1.1.0)
|
14
|
-
claide-plugins (0.9.2)
|
15
|
-
cork
|
16
|
-
nap
|
17
|
-
open4 (~> 1.3)
|
18
|
-
coderay (1.1.3)
|
19
|
-
colored2 (3.1.2)
|
20
|
-
cork (0.3.0)
|
21
|
-
colored2 (~> 3.1)
|
22
|
-
danger (8.6.1)
|
23
|
-
claide (~> 1.0)
|
24
|
-
claide-plugins (>= 0.9.2)
|
25
|
-
colored2 (~> 3.1)
|
26
|
-
cork (~> 0.1)
|
27
|
-
faraday (>= 0.9.0, < 2.0)
|
28
|
-
faraday-http-cache (~> 2.0)
|
29
|
-
git (~> 1.7)
|
30
|
-
kramdown (~> 2.3)
|
31
|
-
kramdown-parser-gfm (~> 1.0)
|
32
|
-
no_proxy_fix
|
33
|
-
octokit (~> 4.7)
|
34
|
-
terminal-table (>= 1, < 4)
|
35
|
-
danger-plugin-api (1.0.0)
|
36
|
-
danger (> 2.0)
|
37
|
-
danger-rubocop (0.10.0)
|
38
|
-
danger
|
39
|
-
rubocop (~> 1.0)
|
40
|
-
diff-lcs (1.5.0)
|
41
|
-
faraday (1.10.0)
|
42
|
-
faraday-em_http (~> 1.0)
|
43
|
-
faraday-em_synchrony (~> 1.0)
|
44
|
-
faraday-excon (~> 1.1)
|
45
|
-
faraday-httpclient (~> 1.0)
|
46
|
-
faraday-multipart (~> 1.0)
|
47
|
-
faraday-net_http (~> 1.0)
|
48
|
-
faraday-net_http_persistent (~> 1.0)
|
49
|
-
faraday-patron (~> 1.0)
|
50
|
-
faraday-rack (~> 1.0)
|
51
|
-
faraday-retry (~> 1.0)
|
52
|
-
ruby2_keywords (>= 0.0.4)
|
53
|
-
faraday-em_http (1.0.0)
|
54
|
-
faraday-em_synchrony (1.0.0)
|
55
|
-
faraday-excon (1.1.0)
|
56
|
-
faraday-http-cache (2.4.0)
|
57
|
-
faraday (>= 0.8)
|
58
|
-
faraday-httpclient (1.0.1)
|
59
|
-
faraday-multipart (1.0.4)
|
60
|
-
multipart-post (~> 2)
|
61
|
-
faraday-net_http (1.0.1)
|
62
|
-
faraday-net_http_persistent (1.2.0)
|
63
|
-
faraday-patron (1.0.0)
|
64
|
-
faraday-rack (1.0.0)
|
65
|
-
faraday-retry (1.0.3)
|
66
|
-
ffi (1.15.5)
|
67
|
-
formatador (1.1.0)
|
68
|
-
git (1.11.0)
|
69
|
-
rchardet (~> 1.8)
|
70
|
-
guard (2.18.0)
|
71
|
-
formatador (>= 0.2.4)
|
72
|
-
listen (>= 2.7, < 4.0)
|
73
|
-
lumberjack (>= 1.0.12, < 2.0)
|
74
|
-
nenv (~> 0.1)
|
75
|
-
notiffany (~> 0.0)
|
76
|
-
pry (>= 0.13.0)
|
77
|
-
shellany (~> 0.0)
|
78
|
-
thor (>= 0.18.1)
|
79
|
-
guard-compat (1.2.1)
|
80
|
-
guard-rspec (4.7.3)
|
81
|
-
guard (~> 2.1)
|
82
|
-
guard-compat (~> 1.1)
|
83
|
-
rspec (>= 2.99.0, < 4.0)
|
84
|
-
json (2.6.2)
|
85
|
-
kramdown (2.4.0)
|
86
|
-
rexml
|
87
|
-
kramdown-parser-gfm (1.1.0)
|
88
|
-
kramdown (~> 2.0)
|
89
|
-
listen (3.7.1)
|
90
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
91
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
92
|
-
lumberjack (1.2.8)
|
93
|
-
method_source (1.0.0)
|
94
|
-
multipart-post (2.2.3)
|
95
|
-
nap (1.1.0)
|
96
|
-
nenv (0.3.0)
|
97
|
-
no_proxy_fix (0.1.2)
|
98
|
-
notiffany (0.1.3)
|
99
|
-
nenv (~> 0.1)
|
100
|
-
shellany (~> 0.0)
|
101
|
-
octokit (4.25.1)
|
102
|
-
faraday (>= 1, < 3)
|
103
|
-
sawyer (~> 0.9)
|
104
|
-
open4 (1.3.4)
|
105
|
-
parallel (1.22.1)
|
106
|
-
parser (3.1.2.0)
|
107
|
-
ast (~> 2.4.1)
|
108
|
-
pry (0.14.1)
|
109
|
-
coderay (~> 1.1)
|
110
|
-
method_source (~> 1.0)
|
111
|
-
public_suffix (4.0.7)
|
112
|
-
rainbow (3.1.1)
|
113
|
-
rake (13.0.6)
|
114
|
-
rb-fsevent (0.11.1)
|
115
|
-
rb-inotify (0.10.1)
|
116
|
-
ffi (~> 1.0)
|
117
|
-
rchardet (1.8.0)
|
118
|
-
regexp_parser (2.5.0)
|
119
|
-
rexml (3.2.5)
|
120
|
-
rspec (3.11.0)
|
121
|
-
rspec-core (~> 3.11.0)
|
122
|
-
rspec-expectations (~> 3.11.0)
|
123
|
-
rspec-mocks (~> 3.11.0)
|
124
|
-
rspec-core (3.11.0)
|
125
|
-
rspec-support (~> 3.11.0)
|
126
|
-
rspec-expectations (3.11.0)
|
127
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
128
|
-
rspec-support (~> 3.11.0)
|
129
|
-
rspec-mocks (3.11.1)
|
130
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
131
|
-
rspec-support (~> 3.11.0)
|
132
|
-
rspec-support (3.11.0)
|
133
|
-
rubocop (1.31.2)
|
134
|
-
json (~> 2.3)
|
135
|
-
parallel (~> 1.10)
|
136
|
-
parser (>= 3.1.0.0)
|
137
|
-
rainbow (>= 2.2.2, < 4.0)
|
138
|
-
regexp_parser (>= 1.8, < 3.0)
|
139
|
-
rexml (>= 3.2.5, < 4.0)
|
140
|
-
rubocop-ast (>= 1.18.0, < 2.0)
|
141
|
-
ruby-progressbar (~> 1.7)
|
142
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
143
|
-
rubocop-ast (1.19.1)
|
144
|
-
parser (>= 3.1.1.0)
|
145
|
-
ruby-progressbar (1.11.0)
|
146
|
-
ruby2_keywords (0.0.5)
|
147
|
-
sawyer (0.9.2)
|
148
|
-
addressable (>= 2.3.5)
|
149
|
-
faraday (>= 0.17.3, < 3)
|
150
|
-
shellany (0.0.1)
|
151
|
-
terminal-table (3.0.2)
|
152
|
-
unicode-display_width (>= 1.1.1, < 3)
|
153
|
-
thor (1.2.1)
|
154
|
-
unicode-display_width (2.2.0)
|
155
|
-
webrick (1.7.0)
|
156
|
-
yard (0.9.28)
|
157
|
-
webrick (~> 1.7.0)
|
158
|
-
|
159
|
-
PLATFORMS
|
160
|
-
ruby
|
161
|
-
universal-darwin-20
|
162
|
-
|
163
|
-
DEPENDENCIES
|
164
|
-
bundler (~> 2.0)
|
165
|
-
danger
|
166
|
-
danger-periphery!
|
167
|
-
danger-rubocop
|
168
|
-
guard
|
169
|
-
guard-rspec
|
170
|
-
listen
|
171
|
-
pry
|
172
|
-
rake
|
173
|
-
rspec
|
174
|
-
rubocop
|
175
|
-
yard
|
176
|
-
|
177
|
-
BUNDLED WITH
|
178
|
-
2.3.6
|
data/Guardfile
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ::Guard
|
4
|
-
class Periphery < Plugin
|
5
|
-
def initialize(options = {})
|
6
|
-
opts = options.dup
|
7
|
-
@command = [
|
8
|
-
"bin/periphery",
|
9
|
-
"scan",
|
10
|
-
"--project",
|
11
|
-
opts.delete(:project),
|
12
|
-
"--targets",
|
13
|
-
opts.delete(:targets),
|
14
|
-
"--schemes",
|
15
|
-
opts.delete(:schemes),
|
16
|
-
"--format",
|
17
|
-
"checkstyle"
|
18
|
-
]
|
19
|
-
super(opts)
|
20
|
-
end
|
21
|
-
|
22
|
-
def run_all
|
23
|
-
UI.info(@command.shelljoin)
|
24
|
-
system(*@command)
|
25
|
-
end
|
26
|
-
|
27
|
-
def run_on_changes(_paths)
|
28
|
-
run_all
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
guard :rspec, cmd: "bundle exec rspec -t ~slow", run_all: { cmd: "bundle exec rspec" } do
|
34
|
-
require "guard/rspec/dsl"
|
35
|
-
dsl = Guard::RSpec::Dsl.new(self)
|
36
|
-
|
37
|
-
rspec = dsl.rspec
|
38
|
-
watch(rspec.spec_helper) { rspec.spec_dir }
|
39
|
-
watch(rspec.spec_support) { rspec.spec_dir }
|
40
|
-
watch(rspec.spec_files)
|
41
|
-
|
42
|
-
ruby = dsl.ruby
|
43
|
-
dsl.watch_spec_files_for(ruby.lib_files)
|
44
|
-
end
|
45
|
-
|
46
|
-
guard :periphery, project: "spec/support/fixtures/test.xcodeproj", targets: "test", schemes: "test" do
|
47
|
-
watch("spec/support/fixtures/test/main.swift")
|
48
|
-
end
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2021 Ryosuke Ito <rito.0305@gmail.com>
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
# danger-periphery
|
2
|
-
|
3
|
-
[![Test](https://github.com/manicmaniac/danger-periphery/actions/workflows/test.yml/badge.svg)](https://github.com/manicmaniac/danger-periphery/actions/workflows/test.yml)
|
4
|
-
|
5
|
-
A Danger plugin to detect unused codes.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
You need to install [Periphery](https://github.com/peripheryapp/periphery) beforehand.
|
10
|
-
|
11
|
-
Write the following code in your Gemfile.
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
gem "danger-periphery"
|
15
|
-
```
|
16
|
-
|
17
|
-
## Usage
|
18
|
-
|
19
|
-
If you already have `.periphery.yml`, the easiest way to use is just add this to your Dangerfile.
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
periphery.scan
|
23
|
-
```
|
24
|
-
|
25
|
-
You can specify the path to executable in this way.
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
periphery.binary_path = "bin/periphery"
|
29
|
-
```
|
30
|
-
|
31
|
-
You can pass command line options to `periphery.scan` like the following.
|
32
|
-
See `periphery scan -h` for available options.
|
33
|
-
|
34
|
-
```ruby
|
35
|
-
periphery.scan(
|
36
|
-
project: "Foo.xcodeproj",
|
37
|
-
schemes: ["foo", "bar"],
|
38
|
-
targets: "foo",
|
39
|
-
clean_build: true
|
40
|
-
)
|
41
|
-
```
|
42
|
-
|
43
|
-
## Advanced Usage
|
44
|
-
|
45
|
-
### Postprocess warnings by passing block to `#scan`
|
46
|
-
|
47
|
-
You can modify warnings as you like by passing a block to `scan`.
|
48
|
-
`scan` takes a block that receives `ScanResult` instance as arguments.
|
49
|
-
Each `ScanResult` instance corresponds with each entry of Danger warnings.
|
50
|
-
If that block returns falsy value, danger-periphery suppresses the corresponding warning.
|
51
|
-
|
52
|
-
For example, if you want your team members to be careful with warnings, the following code may work.
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
periphery.scan do |violation|
|
56
|
-
violation.message = "Pay attention please! #{violation.message}"
|
57
|
-
end
|
58
|
-
```
|
59
|
-
|
60
|
-
For another example, if you want to suppress warnings complaining about unused parameter of many of `didChangeValue(_ sender: Any)` methods, you can suppress this kind of warnings in the following way.
|
61
|
-
|
62
|
-
```ruby
|
63
|
-
periphery.scan do |violation|
|
64
|
-
! violation.message.match(/Parameter 'sender' is unused/)
|
65
|
-
end
|
66
|
-
```
|
67
|
-
|
68
|
-
### Postprocess warnings by calling `#process_warnings`
|
69
|
-
|
70
|
-
You can modify warnings as you like by passing a block to `process_warnings`.
|
71
|
-
`process_warnings` takes a block that receives `[path, line, column, message]` as arguments and returns one of the following types.
|
72
|
-
|
73
|
-
- `Array` that exactly contains `[path, line, column, message]`
|
74
|
-
- `true`
|
75
|
-
- `false`
|
76
|
-
- `nil`
|
77
|
-
|
78
|
-
If an `Array` is returned, danger-periphery uses the values in an array instead of the raw result produced by Periphery.
|
79
|
-
`true` has the same meaning as `[path, line, column, message]`, the argument array as-is.
|
80
|
-
|
81
|
-
If it returns `false` or `nil`, the processing warning will be suppressed.
|
82
|
-
|
83
|
-
For example, if you want your team members to be careful with warnings, the following code may work.
|
84
|
-
|
85
|
-
```ruby
|
86
|
-
periphery.process_warnings do |path, line, column, message|
|
87
|
-
[path, line, column, "Pay attention please! #{message}"]
|
88
|
-
end
|
89
|
-
```
|
90
|
-
|
91
|
-
Or if you want to suppress all `unused` warnings, to return `nil` or `false` in the block works.
|
92
|
-
|
93
|
-
```ruby
|
94
|
-
periphery.process_warnings do |path, line, column, message|
|
95
|
-
!message.match(/unused/i)
|
96
|
-
end
|
97
|
-
```
|
98
|
-
|
99
|
-
## Development
|
100
|
-
|
101
|
-
1. Clone this repo
|
102
|
-
2. Run `bundle install` to setup dependencies.
|
103
|
-
3. Run `bin/download_periphery` to install Periphery.
|
104
|
-
4. Run `bundle exec rake spec` to run the tests.
|
105
|
-
5. Use `bundle exec guard` to automatically have tests run as you make changes.
|
106
|
-
6. Make your changes.
|