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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pmd/gem_version.rb +1 -1
- data/lib/pmd/plugin.rb +7 -13
- data/spec/pmd_spec.rb +8 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d44fdbb62edb14a8de5ece8c8340f4746c300e8c54fae34a72436dd42ae5ec1
|
4
|
+
data.tar.gz: 60d66c53e9495fee4e5238625504458168b3c4bf68fb08f1188fbfa26560a483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9f06385c7419e7b671e941bc89cce31e909220aab39f84a1837f5a5a680d3e571f8653b86b4b43b999e6f6495be4f7740d252592baeb3efad5713d1a7dd165
|
7
|
+
data.tar.gz: 7512fe083ce53ced178c0a92b23ce8e02ba7d8b411533ef18fa92165b6bf876b963ebfdd0905e7bfdb1f0d7e231c742c2fed05c2835c39101bd21cae9f7847b8
|
data/Gemfile.lock
CHANGED
data/lib/pmd/gem_version.rb
CHANGED
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
|
-
|
95
|
-
report_files
|
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(
|
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 =
|
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 =
|
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(
|
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
|