danger-pmd 0.2.2 → 0.3.0
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/Gemfile.lock +1 -1
- data/lib/pmd/{pmd_file.rb → entity/pmd_file.rb} +0 -0
- data/lib/pmd/{pmd_violation.rb → entity/pmd_violation.rb} +0 -0
- data/lib/pmd/gem_version.rb +1 -1
- data/lib/pmd/plugin.rb +1 -1
- data/spec/entity/pmd_file_spec.rb +48 -0
- data/spec/pmd_spec.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1891cd48c4d313436dc6a38d0fe0bf26fd21dbd79555633777609fc6755c0f4
|
4
|
+
data.tar.gz: f6f2058ea738fa34b78a53af6376eb9d93ad4887fd803a8f535b58eaed5bd568
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75d23626c4d10bd650f4ac2bf6c5b210efaec64f49b86400de2b3cf89ff40c61384032567a9ceb7c02d67afeb3e13ade638c55d08affca736d4094317926825d
|
7
|
+
data.tar.gz: 5d270e5700d22cdd523fe41c0bac67ed0603fc82158000706f35ae7fc358af7cce5971f040dd3babb33dbde6e7c751e1ecfc27932517b6f3775b98d8186bdc07
|
data/Gemfile.lock
CHANGED
File without changes
|
File without changes
|
data/lib/pmd/gem_version.rb
CHANGED
data/lib/pmd/plugin.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../spec_helper"
|
4
|
+
|
5
|
+
module Pmd
|
6
|
+
require "oga"
|
7
|
+
|
8
|
+
describe PmdFile do
|
9
|
+
it "should initialize relative path ending with file separator" do
|
10
|
+
xml = Oga.parse_xml(File.open("spec/fixtures/pmd_report.xml"))
|
11
|
+
pmd_file = PmdFile.new("/Users/developer/sample/", xml.xpath("//file").first)
|
12
|
+
|
13
|
+
expect(pmd_file.absolute_path).to eq("/Users/developer/sample/app/src/main/java/com/android/sample/Tools.java")
|
14
|
+
expect(pmd_file.relative_path).to eq("app/src/main/java/com/android/sample/Tools.java")
|
15
|
+
expect(pmd_file.violations).not_to be_nil
|
16
|
+
expect(pmd_file.violations.length).to eq(1)
|
17
|
+
expect(pmd_file.violations.first).not_to be_nil
|
18
|
+
expect(pmd_file.violations.first.line).to eq(5)
|
19
|
+
expect(pmd_file.violations.first.description).to eq("The utility class name 'Tools' doesn't match '[A-Z][a-zA-Z0-9]+(Utils?|Helper)'")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should initialize relative path not ending with file separator" do
|
23
|
+
xml = Oga.parse_xml(File.open("spec/fixtures/pmd_report.xml"))
|
24
|
+
pmd_file = PmdFile.new("/Users/developer/sample", xml.xpath("//file").first)
|
25
|
+
|
26
|
+
expect(pmd_file.absolute_path).to eq("/Users/developer/sample/app/src/main/java/com/android/sample/Tools.java")
|
27
|
+
expect(pmd_file.relative_path).to eq("app/src/main/java/com/android/sample/Tools.java")
|
28
|
+
expect(pmd_file.violations).not_to be_nil
|
29
|
+
expect(pmd_file.violations.length).to eq(1)
|
30
|
+
expect(pmd_file.violations.first).not_to be_nil
|
31
|
+
expect(pmd_file.violations.first.line).to eq(5)
|
32
|
+
expect(pmd_file.violations.first.description).to eq("The utility class name 'Tools' doesn't match '[A-Z][a-zA-Z0-9]+(Utils?|Helper)'")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should initialize relative path not prefixed" do
|
36
|
+
xml = Oga.parse_xml(File.open("spec/fixtures/pmd_report.xml"))
|
37
|
+
pmd_file = PmdFile.new("/Users/developer/something", xml.xpath("//file").first)
|
38
|
+
|
39
|
+
expect(pmd_file.absolute_path).to eq("/Users/developer/sample/app/src/main/java/com/android/sample/Tools.java")
|
40
|
+
expect(pmd_file.relative_path).to eq("/Users/developer/sample/app/src/main/java/com/android/sample/Tools.java")
|
41
|
+
expect(pmd_file.violations).not_to be_nil
|
42
|
+
expect(pmd_file.violations.length).to eq(1)
|
43
|
+
expect(pmd_file.violations.first).not_to be_nil
|
44
|
+
expect(pmd_file.violations.first.line).to eq(5)
|
45
|
+
expect(pmd_file.violations.first.description).to eq("The utility class name 'Tools' doesn't match '[A-Z][a-zA-Z0-9]+(Utils?|Helper)'")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/pmd_spec.rb
CHANGED
@@ -176,7 +176,7 @@ module Danger
|
|
176
176
|
allow_any_instance_of(Danger::DangerPmd).to receive(:target_files).and_return(target_files)
|
177
177
|
|
178
178
|
@pmd.report_files = ["spec/fixtures/pmd_report.xml", "spec/fixtures/**/pmd_sub_report.xml"]
|
179
|
-
@pmd.root_path = "/Users/developer/sample"
|
179
|
+
@pmd.root_path = "/Users/developer/sample/"
|
180
180
|
@pmd.skip_gradle_task = true
|
181
181
|
|
182
182
|
pmd_issues = @pmd.report
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathieu Rul
|
@@ -183,10 +183,11 @@ files:
|
|
183
183
|
- danger-pmd.gemspec
|
184
184
|
- lib/danger_plugin.rb
|
185
185
|
- lib/danger_pmd.rb
|
186
|
+
- lib/pmd/entity/pmd_file.rb
|
187
|
+
- lib/pmd/entity/pmd_violation.rb
|
186
188
|
- lib/pmd/gem_version.rb
|
187
189
|
- lib/pmd/plugin.rb
|
188
|
-
-
|
189
|
-
- lib/pmd/pmd_violation.rb
|
190
|
+
- spec/entity/pmd_file_spec.rb
|
190
191
|
- spec/fixtures/pmd_report.xml
|
191
192
|
- spec/fixtures/report_1/pmd_sub_report.xml
|
192
193
|
- spec/fixtures/report_2/pmd_sub_report.xml
|
@@ -216,6 +217,7 @@ signing_key:
|
|
216
217
|
specification_version: 4
|
217
218
|
summary: A Danger plugin for PMD (Programming Mistake Detector), see https://pmd.github.io.
|
218
219
|
test_files:
|
220
|
+
- spec/entity/pmd_file_spec.rb
|
219
221
|
- spec/fixtures/pmd_report.xml
|
220
222
|
- spec/fixtures/report_1/pmd_sub_report.xml
|
221
223
|
- spec/fixtures/report_2/pmd_sub_report.xml
|