danger-warnings_next_generation 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b52ea983c720acd63ecb4db0b2c3b2d401eaaf72402c4cb6382572bb36e5343c
4
- data.tar.gz: 8c7a354b7a3144c6120e160af5ba3fba1b56d3fcb71bc04e2fd0df03b9c5c273
3
+ metadata.gz: eba6ffd3c7485975a270122fa89b748f08882d7616cc5cee693001789f298a99
4
+ data.tar.gz: 306a28d2ca2cf49b11c0e43d958380be89ac59bd359b00d4050e2ba3fe5a539e
5
5
  SHA512:
6
- metadata.gz: 4d752d89c6d88b8d3b0005b799cb7d5d08cc3e3f108dd5a3825d8e489a526d1d2a92ee61bbdba8777217d6481ab3fecdffed8fda6d172f68ebc408007fcd85be
7
- data.tar.gz: 6ac93eaa6e2dd50b1a31c311581eea2238e71657d5b54047af8e44a2cc4222d74fd881805bf9768487c545826dfe9b5947072c244f5c3c291731ab416dae44e2
6
+ metadata.gz: 0d16ae24773329a9ece05fa147eaa68d1cd2cb23d220163a5e67c307d771d9b3db4ca33baef4aab556014222e7763a466204c83030eccbd264972b4ee5b861e7
7
+ data.tar.gz: f5bb67adfb5df821b6dcffd163a6664ce1ed7c1e63e752c0c45141a90049868556944285150d040c90c6e04c2fb80a1347c7fb6cf0b1f4aab94f1f98b443bb74
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.1] - 2019-5-17
8
+ ### Fixed
9
+ - Remove line breaks from message to avoid broken tables.
10
+ - Adjust category and type message
11
+
7
12
  ## [0.1.0] - 2019-5-17
8
13
  ### Added
9
14
  - Add option to pass basic authentication
data/README.md CHANGED
@@ -101,16 +101,15 @@ This plugin is inspired and works only with the jenkins [warnings-ng-plugin](htt
101
101
  |**Severity**|**File**|**Description**|
102
102
  |---|---|---|
103
103
  |NORMAL|ProductDetailPageFragment.kt:135|[Deprecation] 'getColor(Int): Int' is deprecated. Deprecated in Java|
104
- |NORMAL|ImageGalleryFragment.kt:40|[] Type mismatch: inferred type is java.util.ArrayList<String!>? but kotlin.collections.ArrayList<String> /* = java.util.ArrayList<String> */ was expected|
105
- |NORMAL|ImageGalleryFragment.kt:87|[Deprecation] 'getColor(Int): Int' is deprecated. Deprecated in Java|
106
- |NORMAL|ImageGalleryFragment.kt:90|[Deprecation] 'getColor(Int): Int' is deprecated. Deprecated in Java|
104
+ |NORMAL|ImageGalleryFragment.kt:40|Type mismatch: inferred type is java.util.ArrayList<String!>? but kotlin.collections.ArrayList<String> /* = java.util.ArrayList<String> */ was expected|
105
+ |NORMAL|MyUtil.java:5|[Design - HideUtilityClassConstructorCheck] 'getColor(Int): Int' is deprecated. Deprecated in Java|
107
106
 
108
107
 
109
108
  ### As inline
110
109
  ```text
111
110
  NORMAL
112
- [Deprecation]
113
- getColor(Int): Int' is deprecated. Deprecated in Java
111
+ [Correctness - GradleDependency]
112
+ Obsolete Gradle Dependency A newer version of com.android.support:design than 27.1.1 is available: 28.0.0 This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.
114
113
  ```
115
114
 
116
115
  ## Installation
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WarningsNextGeneration
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -167,9 +167,8 @@ module Danger
167
167
  severity = issue["severity"]
168
168
  file = File.basename(issue["fileName"])
169
169
  line = issue["lineStart"]
170
- message = issue["message"]
171
- category = issue["category"]
172
- table.line(severity, "#{file}:#{line}", "[#{category}] #{message}")
170
+ message = issue["message"].gsub("\n", " ")
171
+ table.line(severity, "#{file}:#{line}", "#{category_type(issue)} #{message}")
173
172
  end
174
173
  content = +"### #{name}\n\n"
175
174
  content << table.to_markdown
@@ -185,15 +184,29 @@ module Danger
185
184
  file = issue["fileName"].gsub(baseline, "")
186
185
  line = issue["lineStart"]
187
186
  message = issue["message"]
188
- category = issue["category"]
189
187
 
190
188
  next unless file_in_changeset?(file)
191
189
 
192
- inline_message = "#{severity}\n[#{category}]\n#{message}"
190
+ inline_message = "#{severity}\n#{category_type(issue)}\n#{message}"
193
191
  message(inline_message, file: file, line: line)
194
192
  end
195
193
  end
196
194
 
195
+ def category_type(issue)
196
+ category = issue["category"]
197
+ type = issue["type"]
198
+ result = ""
199
+
200
+ if (category && !category.empty?) || (type && !type.empty?)
201
+ result = +"["
202
+ result << category.to_s unless category&.empty?
203
+ result << " - " if (category && !category.empty?) && (type && !type.empty?)
204
+ result << type.to_s unless type&.empty?
205
+ result << "]"
206
+ end
207
+ result
208
+ end
209
+
197
210
  def tool_entries
198
211
  json = aggregation_result
199
212
  json["tools"]
@@ -217,6 +217,119 @@ module Danger
217
217
  expect(message.file).not_to include(JAVA_ALL_BASELINE)
218
218
  expect(message.file.chars.first).not_to eql("/")
219
219
  end
220
+
221
+ it "message will not contain new lines" do
222
+ aggregation_return("/assets/aggregation_single.json")
223
+ issues = android_lint_issues
224
+ issue = issues["issues"].first
225
+ expect(issue["message"]).to include("\n")
226
+ details_return_issue(issues)
227
+ @my_plugin.tools_report
228
+
229
+ markdowns = @dangerfile.status_report[:markdowns]
230
+ expect(markdowns.length).to be(1)
231
+ expect(markdowns.first.message.split("|").last).not_to include("\n")
232
+ end
233
+
234
+ it "category and type both added" do
235
+ aggregation_return("/assets/aggregation_single.json")
236
+ issues = android_lint_issues
237
+ issue = issues["issues"].first
238
+ issue["category"] = "TEST_CATEGORY"
239
+ issue["type"] = "TEST_TYPE"
240
+ details_return_issue(issues)
241
+ @my_plugin.tools_report
242
+
243
+ markdowns = @dangerfile.status_report[:markdowns]
244
+ expect(markdowns.length).to be(1)
245
+ expect(markdowns.first.message).to include("[TEST_CATEGORY - TEST_TYPE]")
246
+ end
247
+
248
+ it "type empty not added" do
249
+ aggregation_return("/assets/aggregation_single.json")
250
+ issues = android_lint_issues
251
+ issue = issues["issues"].first
252
+ issue["category"] = "TEST_CATEGORY"
253
+ issue["type"] = ""
254
+ details_return_issue(issues)
255
+ @my_plugin.tools_report
256
+
257
+ markdowns = @dangerfile.status_report[:markdowns]
258
+ expect(markdowns.length).to be(1)
259
+ expect(markdowns.first.message).to include("[TEST_CATEGORY]")
260
+ end
261
+
262
+ it "type nil not added" do
263
+ aggregation_return("/assets/aggregation_single.json")
264
+ issues = android_lint_issues
265
+ issue = issues["issues"].first
266
+ issue["category"] = "TEST_CATEGORY"
267
+ issue["type"] = nil
268
+ details_return_issue(issues)
269
+ @my_plugin.tools_report
270
+
271
+ markdowns = @dangerfile.status_report[:markdowns]
272
+ expect(markdowns.length).to be(1)
273
+ expect(markdowns.first.message).to include("[TEST_CATEGORY]")
274
+ end
275
+
276
+ it "category empty not added" do
277
+ aggregation_return("/assets/aggregation_single.json")
278
+ issues = android_lint_issues
279
+ issue = issues["issues"].first
280
+ issue["category"] = ""
281
+ issue["type"] = "TEST_TYPE"
282
+ details_return_issue(issues)
283
+ @my_plugin.tools_report
284
+
285
+ markdowns = @dangerfile.status_report[:markdowns]
286
+ expect(markdowns.length).to be(1)
287
+ expect(markdowns.first.message).to include("[TEST_TYPE]")
288
+ end
289
+
290
+ it "category nil not added" do
291
+ aggregation_return("/assets/aggregation_single.json")
292
+ issues = android_lint_issues
293
+ issue = issues["issues"].first
294
+ issue["category"] = nil
295
+ issue["type"] = "TEST_TYPE"
296
+ details_return_issue(issues)
297
+ @my_plugin.tools_report
298
+
299
+ markdowns = @dangerfile.status_report[:markdowns]
300
+ expect(markdowns.length).to be(1)
301
+ expect(markdowns.first.message).to include("[TEST_TYPE]")
302
+ end
303
+
304
+ it "category and type empty not added" do
305
+ aggregation_return("/assets/aggregation_single.json")
306
+ issues = android_lint_issues
307
+ issue = issues["issues"].first
308
+ issue["category"] = ""
309
+ issue["type"] = ""
310
+ details_return_issue(issues)
311
+ @my_plugin.tools_report
312
+
313
+ markdowns = @dangerfile.status_report[:markdowns]
314
+ expect(markdowns.length).to be(1)
315
+ expect(markdowns.first.message).not_to include("[")
316
+ expect(markdowns.first.message).not_to include("]")
317
+ end
318
+
319
+ it "category and type nil not added" do
320
+ aggregation_return("/assets/aggregation_single.json")
321
+ issues = android_lint_issues
322
+ issue = issues["issues"].first
323
+ issue["category"] = nil
324
+ issue["type"] = nil
325
+ details_return_issue(issues)
326
+ @my_plugin.tools_report
327
+
328
+ markdowns = @dangerfile.status_report[:markdowns]
329
+ expect(markdowns.length).to be(1)
330
+ expect(markdowns.first.message).not_to include("[")
331
+ expect(markdowns.first.message).not_to include("]")
332
+ end
220
333
  end
221
334
  end
222
335
  end
@@ -240,6 +353,37 @@ def details_return(file)
240
353
  @my_plugin.stubs(:details_result).returns(json)
241
354
  end
242
355
 
356
+ def details_return_issue(issue)
357
+ @my_plugin.stubs(:details_result).returns(issue)
358
+ end
359
+
360
+ def android_lint_issues
361
+ json = {
362
+ "issues": [
363
+ {
364
+ "baseName": "AndroidManifest.xml",
365
+ "category": "Internationalization:Bidirectional Text",
366
+ "columnEnd": 0,
367
+ "columnStart": 0,
368
+ "description": "",
369
+ "fileName": "/var/lib/jenkins/workspace/Jenkins/Examples/android/MR6--danger/repository/mylibrary/src/main/AndroidManifest.xml",
370
+ "fingerprint": "4F7305CA47CE9CFC2A8E9BE4287E79F8",
371
+ "lineEnd": 0,
372
+ "lineStart": 0,
373
+ "message": "Using RTL attributes without enabling RTL support\nThe project references RTL attributes, but does not explicitly enable or disable RTL support with `android:supportsRtl` in the manifest\nTo enable right-to-left support, when running on API 17 and higher, you must set the `android:supportsRtl` attribute in the manifest `<application>` element.&#xA;&#xA;If you have started adding RTL attributes, but have not yet finished the migration, you can set the attribute to false to satisfy this lint check.",
374
+ "moduleName": "",
375
+ "origin": "android-lint",
376
+ "packageName": "-",
377
+ "reference": "3",
378
+ "severity": "NORMAL",
379
+ "type": "RtlEnabled",
380
+ },
381
+ ],
382
+ }
383
+ serialized = JSON.generate(json)
384
+ JSON.parse(serialized)
385
+ end
386
+
243
387
  def target_files_return_java_all
244
388
  @my_plugin.stubs(:target_files).returns(["app/src/main/java/com/projectname/b2bshop/fragment/gallery/ImageGalleryFragment.kt",
245
389
  "app/src/main/java/com/projectname/b2bshop/webservice/requestqueue/RequestQueue.java",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-warnings_next_generation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Schwamberger