danger-warnings_next_generation 0.1.1 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/warnings_next_generation/gem_version.rb +1 -1
- data/lib/warnings_next_generation/markdown_table.rb +4 -0
- data/lib/warnings_next_generation/plugin.rb +25 -12
- data/spec/assets/{java_all.json → java_detail_all.json} +0 -0
- data/spec/assets/java_detail_one.json +24 -0
- data/spec/warnings_next_generation_spec.rb +40 -15
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca8908ac2dbb49d19073752e2f3080d18619db630da9458e4f3cf5754c0e5e10
|
4
|
+
data.tar.gz: 46682178b08d1c87e250bbe9a8910603efcea9f23abb5d3f6ca7ddb31fc66be4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42b11cee07c972faacb608b1dac054dc2f7cec481b693179e74e139045cf5e8f8ae6d874c8b6fa55e0b49be6291856950bea4aaef714dd2142dcb414d75f891a
|
7
|
+
data.tar.gz: 48c2a489c9681d53ca4fe04c3382f955583ab26fc6dc144dc431f56056f3ab6bcf12868f577a709ea74db222f3f55dc7e76aa632db7f961c0cee05155309b137
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.1.2] - 2019-5-27
|
8
|
+
### Fixed
|
9
|
+
- Do not post empty tool report
|
10
|
+
- Only include entries in tool report where basename of file is under changed files
|
11
|
+
|
7
12
|
## [0.1.1] - 2019-5-17
|
8
13
|
### Fixed
|
9
14
|
- Remove line breaks from message to avoid broken tables.
|
data/README.md
CHANGED
@@ -94,7 +94,7 @@ This plugin is inspired and works only with the jenkins [warnings-ng-plugin](htt
|
|
94
94
|
|Android Lint Warnings|10|0|3|
|
95
95
|
|PMD Warnings|:star:|0|0|
|
96
96
|
|Detekt Warnings|10|5|5|
|
97
|
-
|Checkstyle|:star:|0|3|
|
97
|
+
|Checkstyle Warnings|:star:|0|3|
|
98
98
|
|
99
99
|
### Java Warnings
|
100
100
|
|
@@ -70,17 +70,15 @@ module Danger
|
|
70
70
|
url = tool["latestUrl"]
|
71
71
|
id = tool["id"]
|
72
72
|
|
73
|
-
if use_include_option?(options)
|
74
|
-
|
75
|
-
end
|
73
|
+
next if use_include_option?(options) && !tool_ids.include?(id)
|
74
|
+
|
76
75
|
overview = overview_result(url)
|
77
76
|
entry_count += 1
|
78
77
|
overview_entry(overview_table, name, overview)
|
79
78
|
end
|
80
79
|
|
81
|
-
if use_include_option?(options)
|
82
|
-
|
83
|
-
end
|
80
|
+
return if use_include_option?(options) && entry_count.zero?
|
81
|
+
|
84
82
|
markdown("#{WNG_OVERVIEW_TITLE}\n\n#{overview_table.to_markdown}")
|
85
83
|
end
|
86
84
|
|
@@ -99,9 +97,8 @@ module Danger
|
|
99
97
|
url = tool["latestUrl"]
|
100
98
|
id = tool["id"]
|
101
99
|
|
102
|
-
if use_include_option?(options)
|
103
|
-
|
104
|
-
end
|
100
|
+
next if use_include_option?(options) && !tool_ids.include?(id)
|
101
|
+
|
105
102
|
if inline?(options) && check_baseline(options)
|
106
103
|
inline_report(url, baseline(options))
|
107
104
|
else
|
@@ -168,11 +165,17 @@ module Danger
|
|
168
165
|
file = File.basename(issue["fileName"])
|
169
166
|
line = issue["lineStart"]
|
170
167
|
message = issue["message"].gsub("\n", " ")
|
168
|
+
|
169
|
+
next unless basename_in_changeset?(file)
|
170
|
+
|
171
171
|
table.line(severity, "#{file}:#{line}", "#{category_type(issue)} #{message}")
|
172
172
|
end
|
173
|
-
|
174
|
-
|
175
|
-
|
173
|
+
|
174
|
+
unless table.size.zero?
|
175
|
+
content = +"### #{name}\n\n"
|
176
|
+
content << table.to_markdown
|
177
|
+
markdown(content)
|
178
|
+
end
|
176
179
|
end
|
177
180
|
|
178
181
|
def inline_report(url, baseline)
|
@@ -223,6 +226,16 @@ module Danger
|
|
223
226
|
target_files.include?(file)
|
224
227
|
end
|
225
228
|
|
229
|
+
def basename_in_changeset?(file)
|
230
|
+
result = false
|
231
|
+
target_files.each do |change|
|
232
|
+
break if result
|
233
|
+
|
234
|
+
result = change.include?(File.basename(file))
|
235
|
+
end
|
236
|
+
result
|
237
|
+
end
|
238
|
+
|
226
239
|
def target_files
|
227
240
|
@target_files ||= git.modified_files + git.added_files
|
228
241
|
end
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi",
|
3
|
+
"issues": [
|
4
|
+
{
|
5
|
+
"baseName": "ProductDetailPageFragment.kt",
|
6
|
+
"category": "Deprecation",
|
7
|
+
"columnEnd": 54,
|
8
|
+
"columnStart": 54,
|
9
|
+
"description": "",
|
10
|
+
"fileName": "/var/lib/jenkins/workspace/projectname/b2b-app-android-analyze/repository/app/src/main/java/com/projectname/b2bshop/fragment/ProductDetailPageFragment.kt",
|
11
|
+
"fingerprint": "07D91BE07253C0864B9B4F05F0308B28",
|
12
|
+
"lineEnd": 135,
|
13
|
+
"lineStart": 135,
|
14
|
+
"message": "'getColor(Int): Int' is deprecated. Deprecated in Java",
|
15
|
+
"moduleName": "",
|
16
|
+
"origin": "java",
|
17
|
+
"packageName": "-",
|
18
|
+
"reference": "5",
|
19
|
+
"severity": "NORMAL",
|
20
|
+
"type": "-"
|
21
|
+
}
|
22
|
+
],
|
23
|
+
"size": 1
|
24
|
+
}
|
@@ -14,6 +14,7 @@ module Danger
|
|
14
14
|
before do
|
15
15
|
@dangerfile = testing_dangerfile
|
16
16
|
@my_plugin = @dangerfile.warnings_next_generation
|
17
|
+
target_files_return_java_all
|
17
18
|
end
|
18
19
|
|
19
20
|
describe "overview_report" do
|
@@ -129,7 +130,7 @@ module Danger
|
|
129
130
|
describe "tools_report" do
|
130
131
|
it "list all entries" do
|
131
132
|
aggregation_return("/assets/aggregation_single.json")
|
132
|
-
details_return("/assets/
|
133
|
+
details_return("/assets/java_detail_all.json")
|
133
134
|
@my_plugin.tools_report
|
134
135
|
|
135
136
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -141,7 +142,7 @@ module Danger
|
|
141
142
|
|
142
143
|
it "no configuration list all warnings reports" do
|
143
144
|
aggregation_return("/assets/aggregation.json")
|
144
|
-
details_return("/assets/
|
145
|
+
details_return("/assets/java_detail_all.json")
|
145
146
|
@my_plugin.tools_report
|
146
147
|
|
147
148
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -150,7 +151,7 @@ module Danger
|
|
150
151
|
|
151
152
|
it "single include adds table" do
|
152
153
|
aggregation_return("/assets/aggregation.json")
|
153
|
-
details_return("/assets/
|
154
|
+
details_return("/assets/java_detail_all.json")
|
154
155
|
@my_plugin.tools_report(include: ["java"])
|
155
156
|
|
156
157
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -160,7 +161,7 @@ module Danger
|
|
160
161
|
|
161
162
|
it "multiple include adds table for each" do
|
162
163
|
aggregation_return("/assets/aggregation.json")
|
163
|
-
details_return("/assets/
|
164
|
+
details_return("/assets/java_detail_all.json")
|
164
165
|
@my_plugin.tools_report(include: %w(java pmd))
|
165
166
|
|
166
167
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -172,7 +173,7 @@ module Danger
|
|
172
173
|
|
173
174
|
it "empty includes add no overview" do
|
174
175
|
aggregation_return("/assets/aggregation.json")
|
175
|
-
details_return("/assets/
|
176
|
+
details_return("/assets/java_detail_all.json")
|
176
177
|
@my_plugin.tools_report(include: [])
|
177
178
|
|
178
179
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -181,7 +182,7 @@ module Danger
|
|
181
182
|
|
182
183
|
it "wrong includes add no overview" do
|
183
184
|
aggregation_return("/assets/aggregation.json")
|
184
|
-
details_return("/assets/
|
185
|
+
details_return("/assets/java_detail_all.json")
|
185
186
|
@my_plugin.tools_report(include: ["not_existing"])
|
186
187
|
|
187
188
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -190,14 +191,13 @@ module Danger
|
|
190
191
|
|
191
192
|
it "inline missing baseline raises error" do
|
192
193
|
aggregation_return("/assets/aggregation_single.json")
|
193
|
-
details_return("/assets/
|
194
|
+
details_return("/assets/java_detail_all.json")
|
194
195
|
expect { @my_plugin.tools_report(inline: true) }.to raise_error(/set 'baseline'/)
|
195
196
|
end
|
196
197
|
|
197
198
|
it "creates inline comments" do
|
198
199
|
aggregation_return("/assets/aggregation_single.json")
|
199
|
-
details_return("/assets/
|
200
|
-
target_files_return_java_all
|
200
|
+
details_return("/assets/java_detail_all.json")
|
201
201
|
@my_plugin.tools_report(inline: true, baseline: JAVA_ALL_BASELINE)
|
202
202
|
|
203
203
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -209,8 +209,7 @@ module Danger
|
|
209
209
|
|
210
210
|
it "inline comments remove baseline" do
|
211
211
|
aggregation_return("/assets/aggregation_single.json")
|
212
|
-
details_return("/assets/
|
213
|
-
target_files_return_java_all
|
212
|
+
details_return("/assets/java_detail_all.json")
|
214
213
|
@my_plugin.tools_report(inline: true, baseline: JAVA_ALL_BASELINE)
|
215
214
|
|
216
215
|
message = @dangerfile.violation_report[:messages].first
|
@@ -224,6 +223,7 @@ module Danger
|
|
224
223
|
issue = issues["issues"].first
|
225
224
|
expect(issue["message"]).to include("\n")
|
226
225
|
details_return_issue(issues)
|
226
|
+
target_files_return_manifest
|
227
227
|
@my_plugin.tools_report
|
228
228
|
|
229
229
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -238,6 +238,7 @@ module Danger
|
|
238
238
|
issue["category"] = "TEST_CATEGORY"
|
239
239
|
issue["type"] = "TEST_TYPE"
|
240
240
|
details_return_issue(issues)
|
241
|
+
target_files_return_manifest
|
241
242
|
@my_plugin.tools_report
|
242
243
|
|
243
244
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -252,6 +253,7 @@ module Danger
|
|
252
253
|
issue["category"] = "TEST_CATEGORY"
|
253
254
|
issue["type"] = ""
|
254
255
|
details_return_issue(issues)
|
256
|
+
target_files_return_manifest
|
255
257
|
@my_plugin.tools_report
|
256
258
|
|
257
259
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -266,6 +268,7 @@ module Danger
|
|
266
268
|
issue["category"] = "TEST_CATEGORY"
|
267
269
|
issue["type"] = nil
|
268
270
|
details_return_issue(issues)
|
271
|
+
target_files_return_manifest
|
269
272
|
@my_plugin.tools_report
|
270
273
|
|
271
274
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -280,6 +283,7 @@ module Danger
|
|
280
283
|
issue["category"] = ""
|
281
284
|
issue["type"] = "TEST_TYPE"
|
282
285
|
details_return_issue(issues)
|
286
|
+
target_files_return_manifest
|
283
287
|
@my_plugin.tools_report
|
284
288
|
|
285
289
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -294,6 +298,7 @@ module Danger
|
|
294
298
|
issue["category"] = nil
|
295
299
|
issue["type"] = "TEST_TYPE"
|
296
300
|
details_return_issue(issues)
|
301
|
+
target_files_return_manifest
|
297
302
|
@my_plugin.tools_report
|
298
303
|
|
299
304
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -308,6 +313,7 @@ module Danger
|
|
308
313
|
issue["category"] = ""
|
309
314
|
issue["type"] = ""
|
310
315
|
details_return_issue(issues)
|
316
|
+
target_files_return_manifest
|
311
317
|
@my_plugin.tools_report
|
312
318
|
|
313
319
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -323,6 +329,7 @@ module Danger
|
|
323
329
|
issue["category"] = nil
|
324
330
|
issue["type"] = nil
|
325
331
|
details_return_issue(issues)
|
332
|
+
target_files_return_manifest
|
326
333
|
@my_plugin.tools_report
|
327
334
|
|
328
335
|
markdowns = @dangerfile.status_report[:markdowns]
|
@@ -330,6 +337,16 @@ module Danger
|
|
330
337
|
expect(markdowns.first.message).not_to include("[")
|
331
338
|
expect(markdowns.first.message).not_to include("]")
|
332
339
|
end
|
340
|
+
|
341
|
+
it "no changed files match does not add report" do
|
342
|
+
aggregation_return("/assets/aggregation_single.json")
|
343
|
+
details_return("/assets/java_detail_one.json")
|
344
|
+
target_files_return(["Unmatched.java"])
|
345
|
+
@my_plugin.tools_report
|
346
|
+
|
347
|
+
markdowns = @dangerfile.status_report[:markdowns]
|
348
|
+
expect(markdowns.length).to be(0)
|
349
|
+
end
|
333
350
|
end
|
334
351
|
end
|
335
352
|
end
|
@@ -385,8 +402,16 @@ def android_lint_issues
|
|
385
402
|
end
|
386
403
|
|
387
404
|
def target_files_return_java_all
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
405
|
+
target_files_return(["app/src/main/java/com/projectname/b2bshop/fragment/gallery/ImageGalleryFragment.kt",
|
406
|
+
"app/src/main/java/com/projectname/b2bshop/webservice/requestqueue/RequestQueue.java",
|
407
|
+
"app/src/main/java/com/projectname/b2bshop/webservice/requestqueue/RequestQueueImpl.java",
|
408
|
+
"app/src/main/java/com/projectname/b2bshop/fragment/ProductDetailPageFragment.kt"])
|
409
|
+
end
|
410
|
+
|
411
|
+
def target_files_return_manifest
|
412
|
+
target_files_return(["AndroidManifest.xml"])
|
413
|
+
end
|
414
|
+
|
415
|
+
def target_files_return(list)
|
416
|
+
@my_plugin.stubs(:target_files).returns(list)
|
392
417
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-warnings_next_generation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Schwamberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -182,7 +182,8 @@ files:
|
|
182
182
|
- spec/assets/example/overview_detekt.json
|
183
183
|
- spec/assets/example/overview_pmd.json
|
184
184
|
- spec/assets/java.json
|
185
|
-
- spec/assets/
|
185
|
+
- spec/assets/java_detail_all.json
|
186
|
+
- spec/assets/java_detail_one.json
|
186
187
|
- spec/assets/java_zero.json
|
187
188
|
- spec/assets/java_zero_new.json
|
188
189
|
- spec/spec_helper.rb
|
@@ -221,7 +222,8 @@ test_files:
|
|
221
222
|
- spec/assets/example/overview_detekt.json
|
222
223
|
- spec/assets/example/overview_pmd.json
|
223
224
|
- spec/assets/java.json
|
224
|
-
- spec/assets/
|
225
|
+
- spec/assets/java_detail_all.json
|
226
|
+
- spec/assets/java_detail_one.json
|
225
227
|
- spec/assets/java_zero.json
|
226
228
|
- spec/assets/java_zero_new.json
|
227
229
|
- spec/spec_helper.rb
|