danger-pmd 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/lib/pmd/gem_version.rb +1 -1
- data/lib/pmd/plugin.rb +21 -2
- data/spec/pmd_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53cc82c8c415625b6288cbe5723362dc833f633d2fbe9ccb0b51e410aa83d989
|
4
|
+
data.tar.gz: bb9a5b9e8658e72cc8092b0623cd0aa645f6d8fb634e0312b8c113b0f7057234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de03c38720bb5f06dfca0ff63c3589d95e6237596e6ce80bd09f87050ef34f4281bda05367f272c1dbf5dae23fbc3c4084b55938c52559e0e97c29967a7fa48
|
7
|
+
data.tar.gz: f18e9d01bf1b6c5c4210226f571637a735575d089b6da85cb37742277e7651ca787f22bc782d498f96cc9605a27343f1058aaa49c04aaadd8022211d4ce4717a
|
data/README.md
CHANGED
@@ -39,25 +39,30 @@ Defaults to "pmd".
|
|
39
39
|
If your pmd task outputs to a different location, you can specify it here.
|
40
40
|
Defaults to "app/build/reports/pmd/pmd.xml".
|
41
41
|
|
42
|
+
`skip_gradle_task` - Skip Gradle task.
|
43
|
+
If you skip Gradle task, for example project does not manage Gradle.
|
44
|
+
|
42
45
|
#### Methods
|
43
46
|
|
44
47
|
`report` - Calls pmd task of your Gradle project.
|
45
48
|
It fails if `gradlew` cannot be found inside current directory.
|
46
49
|
It fails if `report_file` cannot be found inside current directory.
|
47
50
|
|
48
|
-
`target_files` - A getter for current updated files
|
51
|
+
`target_files` - A getter for current updated files.
|
49
52
|
|
50
|
-
`exec_gradle_task` - Run Gradle task
|
53
|
+
`exec_gradle_task` - Run Gradle task.
|
51
54
|
|
52
|
-
`gradlew_exists?` - Check gradlew file exists in current directory
|
55
|
+
`gradlew_exists?` - Check gradlew file exists in current directory.
|
53
56
|
|
54
|
-
`report_file_exist?` - Check report_file exists in current directory
|
57
|
+
`report_file_exist?` - Check report_file exists in current directory.
|
55
58
|
|
56
59
|
`pmd_report` - A getter for `pmd_report`, returning PMD report.
|
57
60
|
|
58
61
|
`pmd_issues` - A getter for PMD issues, returning PMD issues.
|
59
62
|
|
60
|
-
`send_inline_comment` - Send inline comment with danger's warn or fail method
|
63
|
+
`send_inline_comment` - Send inline comment with danger's warn or fail method.
|
64
|
+
|
65
|
+
`skip_gradle_task` - Skip Gradle task.
|
61
66
|
|
62
67
|
## Development
|
63
68
|
|
data/lib/pmd/gem_version.rb
CHANGED
data/lib/pmd/plugin.rb
CHANGED
@@ -15,6 +15,11 @@ module Danger
|
|
15
15
|
# pmd.report_file = "app/build/reports/pmd/pmd.xml"
|
16
16
|
# pmd.report
|
17
17
|
#
|
18
|
+
# @example Running PMD without running a Gradle task
|
19
|
+
#
|
20
|
+
# pmd.skip_gradle_task = true
|
21
|
+
# pmd.report
|
22
|
+
#
|
18
23
|
# @see mathroule/danger-pmd
|
19
24
|
# @tags java, android, pmd
|
20
25
|
|
@@ -39,6 +44,11 @@ module Danger
|
|
39
44
|
# @return [String]
|
40
45
|
attr_writer :report_file
|
41
46
|
|
47
|
+
# Skip Gradle task
|
48
|
+
# If you skip Gradle task, for example project does not manage Gradle.
|
49
|
+
# @return [Bool]
|
50
|
+
attr_writer :skip_gradle_task
|
51
|
+
|
42
52
|
GRADLEW_NOT_FOUND = "Could not find `gradlew` inside current directory"
|
43
53
|
REPORT_FILE_NOT_FOUND = "PMD report not found"
|
44
54
|
|
@@ -47,9 +57,12 @@ module Danger
|
|
47
57
|
# It fails if `report_file` cannot be found inside current directory.
|
48
58
|
# @return [void]
|
49
59
|
def report(inline_mode = true)
|
50
|
-
|
60
|
+
unless skip_gradle_task
|
61
|
+
return fail(GRADLEW_NOT_FOUND) unless gradlew_exists?
|
62
|
+
|
63
|
+
exec_gradle_task
|
64
|
+
end
|
51
65
|
|
52
|
-
exec_gradle_task
|
53
66
|
return fail(REPORT_FILE_NOT_FOUND) unless report_file_exist?
|
54
67
|
|
55
68
|
if inline_mode
|
@@ -69,6 +82,12 @@ module Danger
|
|
69
82
|
@gradle_task ||= "pmd"
|
70
83
|
end
|
71
84
|
|
85
|
+
# A getter for `skip_gradle_task`, returning false if value is nil.
|
86
|
+
# @return [Boolean]
|
87
|
+
def skip_gradle_task
|
88
|
+
@skip_gradle_task ||= false
|
89
|
+
end
|
90
|
+
|
72
91
|
# A getter for `report_file`, returning "app/build/reports/pmd/pmd.xml" if value is nil.
|
73
92
|
# @return [String]
|
74
93
|
def report_file
|
data/spec/pmd_spec.rb
CHANGED
@@ -44,6 +44,16 @@ module Danger
|
|
44
44
|
expect(@my_plugin.gradle_task).to eq(custom_task)
|
45
45
|
end
|
46
46
|
|
47
|
+
it "Skip Gradle task" do
|
48
|
+
skip_gradle_task = true
|
49
|
+
@my_plugin.skip_gradle_task = skip_gradle_task
|
50
|
+
expect(@my_plugin.skip_gradle_task).to eq(skip_gradle_task)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "Check default skip Gradle task" do
|
54
|
+
expect(@my_plugin.skip_gradle_task).to eq(false)
|
55
|
+
end
|
56
|
+
|
47
57
|
it "Create files" do
|
48
58
|
custom_report_path = "spec/fixtures/pmd_report.xml"
|
49
59
|
@my_plugin.report_file = custom_report_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-pmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathieu Rul
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|