danger-pmd 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: 9a2697bcfe2820d4c84823070dffd3ea0062a1aa743c55d1265613eb78865508
4
- data.tar.gz: 61412ff7cae4072811742d730ab19667b0c23584bee3a92cd5ad5241700db2b3
3
+ metadata.gz: 8d44fdbb62edb14a8de5ece8c8340f4746c300e8c54fae34a72436dd42ae5ec1
4
+ data.tar.gz: 60d66c53e9495fee4e5238625504458168b3c4bf68fb08f1188fbfa26560a483
5
5
  SHA512:
6
- metadata.gz: a34d67327b69424a7ac177fd80358881c01159592711d79b62ffc45c3293144692b3549e394c71e287a7471c61a5e58c989259a952f79d51a4181a59a4d73d35
7
- data.tar.gz: 916683f3ed4821208a84f0af44a6d2b33fb13c2769a03b3655d35e6a7ef8d5fd11ef6f913f3a0e4f3ee261be01be08d2a13cf8f8ea4058aa45afe2f2dd997360
6
+ metadata.gz: ec9f06385c7419e7b671e941bc89cce31e909220aab39f84a1837f5a5a680d3e571f8653b86b4b43b999e6f6495be4f7740d252592baeb3efad5713d1a7dd165
7
+ data.tar.gz: 7512fe083ce53ced178c0a92b23ce8e02ba7d8b411533ef18fa92165b6bf876b963ebfdd0905e7bfdb1f0d7e231c742c2fed05c2835c39101bd21cae9f7847b8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-pmd (0.1.0)
4
+ danger-pmd (0.1.1)
5
5
  danger-plugin-api (~> 1.0)
6
6
  oga (~> 2.10)
7
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pmd
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/pmd/plugin.rb CHANGED
@@ -9,13 +9,13 @@ module Danger
9
9
  #
10
10
  # pmd.report
11
11
  #
12
- # @example Running PMD with a specific Gradle task or report file
12
+ # @example Running PMD with a specific Gradle task or report file (glob accepted)
13
13
  #
14
14
  # pmd.gradle_task = 'app:pmd' #defalut: pmd
15
- # pmd.report_file = "app/build/reports/pmd/pmd.xml"
15
+ # pmd.report_file = "module/build/reports/pmd/pmd.xml" #defalut: app/build/reports/pmd/pmd.xml
16
16
  # pmd.report
17
17
  #
18
- # @example Running PMD with an array of report files
18
+ # @example Running PMD with an array of report files (glob accepted)
19
19
  #
20
20
  # pmd.report_files = ["modules/**/build/reports/pmd/pmd.xml", "app/build/reports/pmd/pmd.xml"]
21
21
  # pmd.report
@@ -69,7 +69,7 @@ module Danger
69
69
 
70
70
  # Location of report files.
71
71
  # If your pmd task outputs to a different location, you can specify it here.
72
- # Defaults to "app/build/reports/pmd/pmd.xml".
72
+ # Defaults to ["app/build/reports/pmd/pmd.xml"].
73
73
  # @return [Array[String]]
74
74
  attr_writer :report_files
75
75
 
@@ -91,16 +91,10 @@ module Danger
91
91
  exec_gradle_task
92
92
  end
93
93
 
94
- report_files_flatten = []
95
- report_files.each do |report_file|
96
- Dir.glob(report_file).sort.each do |report_file_glob|
97
- return fail("PMD report file not found #{report_file_glob}") unless report_file_exist?(report_file_glob)
98
-
99
- report_files_flatten.push(report_file_glob)
100
- end
101
- end
94
+ report_files_expanded = Dir.glob(report_files).sort
95
+ return fail("Could not find matching PMD report files for #{report_files} inside current directory") if report_files_expanded.empty?
102
96
 
103
- report_and_send_inline_comment(report_files_flatten, inline_mode)
97
+ report_and_send_inline_comment(report_files_expanded, inline_mode)
104
98
  end
105
99
 
106
100
  private
data/spec/pmd_spec.rb CHANGED
@@ -29,7 +29,7 @@ module Danger
29
29
  end
30
30
 
31
31
  it "Set custom report files paths" do
32
- custom_report_paths = %w(custom-path/pmd_report_1.xml custom-path/pmd_report_2.xml)
32
+ custom_report_paths = ["custom-path/pmd_report_1.xml", "custom-path/pmd_report_2.xml"]
33
33
  @pmd.report_files = custom_report_paths
34
34
  expect(@pmd.report_files).to eq(custom_report_paths)
35
35
  end
@@ -44,16 +44,16 @@ module Danger
44
44
  expect(@pmd.gradle_task).to eq(custom_task)
45
45
  end
46
46
 
47
+ it "Check default skip Gradle task" do
48
+ expect(@pmd.skip_gradle_task).to eq(false)
49
+ end
50
+
47
51
  it "Skip Gradle task" do
48
52
  skip_gradle_task = true
49
53
  @pmd.skip_gradle_task = skip_gradle_task
50
54
  expect(@pmd.skip_gradle_task).to eq(skip_gradle_task)
51
55
  end
52
56
 
53
- it "Check default skip Gradle task" do
54
- expect(@pmd.skip_gradle_task).to eq(false)
55
- end
56
-
57
57
  it "Report with report file" do
58
58
  target_files = [
59
59
  "/Users/developer/sample/app/src/main/java/com/android/sample/MainActivity.java",
@@ -163,7 +163,7 @@ module Danger
163
163
  ]
164
164
  allow_any_instance_of(Danger::DangerPmd).to receive(:target_files).and_return(target_files)
165
165
 
166
- @pmd.report_files = %w(spec/fixtures/pmd_report.xml spec/fixtures/**/pmd_sub_report.xml)
166
+ @pmd.report_files = ["spec/fixtures/pmd_report.xml", "spec/fixtures/**/pmd_sub_report.xml"]
167
167
  @pmd.skip_gradle_task = true
168
168
 
169
169
  pmd_issues = @pmd.report
@@ -257,7 +257,8 @@ module Danger
257
257
 
258
258
  pmd_issues = @pmd.report
259
259
  expect(pmd_issues).not_to be_nil
260
- expect(pmd_issues.length).to be(0)
260
+ expect(pmd_issues.length).to be(1)
261
+ expect(pmd_issues[0]).to eq("Could not find matching PMD report files for [\"spec/fixtures/custom/pmd_report.xml\"] inside current directory")
261
262
  end
262
263
  end
263
264
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-pmd
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
  - Mathieu Rul