danger-pmd 0.4.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/deploy.yml +35 -0
- data/.github/workflows/test.yml +24 -0
- data/.rubocop.yml +4777 -99
- data/Gemfile.lock +96 -63
- data/LICENSE +21 -0
- data/README.md +42 -22
- data/codecov.yml +20 -0
- data/danger-pmd.gemspec +25 -22
- data/lib/danger_plugin.rb +1 -1
- data/lib/danger_pmd.rb +1 -1
- data/lib/pmd/entity/pmd_file.rb +11 -15
- data/lib/pmd/entity/pmd_violation.rb +4 -3
- data/lib/pmd/gem_version.rb +1 -1
- data/lib/pmd/plugin.rb +67 -41
- data/spec/entity/pmd_file_spec.rb +16 -16
- data/spec/pmd_spec.rb +93 -92
- data/spec/spec_helper.rb +24 -18
- metadata +73 -29
- data/.travis.yml +0 -10
- data/LICENSE.txt +0 -22
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-pmd (0.
|
4
|
+
danger-pmd (1.0.5)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
|
-
oga (~> 2.
|
6
|
+
oga (~> 2.15)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -11,40 +11,51 @@ GEM
|
|
11
11
|
addressable (2.7.0)
|
12
12
|
public_suffix (>= 2.0.2, < 5.0)
|
13
13
|
ansi (1.5.0)
|
14
|
-
ast (2.4.
|
14
|
+
ast (2.4.2)
|
15
15
|
claide (1.0.3)
|
16
16
|
claide-plugins (0.9.2)
|
17
17
|
cork
|
18
18
|
nap
|
19
19
|
open4 (~> 1.3)
|
20
|
-
|
20
|
+
codecov (0.5.2)
|
21
|
+
simplecov (>= 0.15, < 0.22)
|
22
|
+
coderay (1.1.3)
|
21
23
|
colored2 (3.1.2)
|
22
24
|
cork (0.3.0)
|
23
25
|
colored2 (~> 3.1)
|
24
|
-
danger (
|
26
|
+
danger (8.2.3)
|
25
27
|
claide (~> 1.0)
|
26
28
|
claide-plugins (>= 0.9.2)
|
27
29
|
colored2 (~> 3.1)
|
28
30
|
cork (~> 0.1)
|
29
|
-
faraday (
|
31
|
+
faraday (>= 0.9.0, < 2.0)
|
30
32
|
faraday-http-cache (~> 2.0)
|
31
|
-
git (~> 1.
|
32
|
-
kramdown (~> 2.
|
33
|
+
git (~> 1.7)
|
34
|
+
kramdown (~> 2.3)
|
33
35
|
kramdown-parser-gfm (~> 1.0)
|
34
36
|
no_proxy_fix
|
35
37
|
octokit (~> 4.7)
|
36
|
-
terminal-table (
|
38
|
+
terminal-table (>= 1, < 4)
|
37
39
|
danger-plugin-api (1.0.0)
|
38
40
|
danger (> 2.0)
|
39
|
-
diff-lcs (1.
|
40
|
-
|
41
|
+
diff-lcs (1.4.4)
|
42
|
+
docile (1.3.5)
|
43
|
+
faraday (1.4.1)
|
44
|
+
faraday-excon (~> 1.1)
|
45
|
+
faraday-net_http (~> 1.0)
|
46
|
+
faraday-net_http_persistent (~> 1.1)
|
41
47
|
multipart-post (>= 1.2, < 3)
|
42
|
-
|
43
|
-
|
44
|
-
|
48
|
+
ruby2_keywords (>= 0.0.4)
|
49
|
+
faraday-excon (1.1.0)
|
50
|
+
faraday-http-cache (2.2.0)
|
51
|
+
faraday (>= 0.8)
|
52
|
+
faraday-net_http (1.0.1)
|
53
|
+
faraday-net_http_persistent (1.1.0)
|
54
|
+
ffi (1.15.0)
|
45
55
|
formatador (0.2.5)
|
46
|
-
git (1.
|
47
|
-
|
56
|
+
git (1.8.1)
|
57
|
+
rchardet (~> 1.8)
|
58
|
+
guard (2.16.2)
|
48
59
|
formatador (>= 0.2.4)
|
49
60
|
listen (>= 2.7, < 4.0)
|
50
61
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -58,15 +69,15 @@ GEM
|
|
58
69
|
guard (~> 2.1)
|
59
70
|
guard-compat (~> 1.1)
|
60
71
|
rspec (>= 2.99.0, < 4.0)
|
61
|
-
|
62
|
-
|
72
|
+
kramdown (2.3.1)
|
73
|
+
rexml
|
63
74
|
kramdown-parser-gfm (1.1.0)
|
64
75
|
kramdown (~> 2.0)
|
65
|
-
listen (3.0.
|
66
|
-
rb-fsevent (>= 0.9.
|
67
|
-
rb-inotify (>= 0.9.7)
|
68
|
-
lumberjack (1.
|
69
|
-
method_source (0.
|
76
|
+
listen (3.0.8)
|
77
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
78
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
79
|
+
lumberjack (1.2.8)
|
80
|
+
method_source (1.0.0)
|
70
81
|
multipart-post (2.1.1)
|
71
82
|
nap (1.1.0)
|
72
83
|
nenv (0.3.0)
|
@@ -74,73 +85,95 @@ GEM
|
|
74
85
|
notiffany (0.1.3)
|
75
86
|
nenv (~> 0.1)
|
76
87
|
shellany (~> 0.0)
|
77
|
-
octokit (4.
|
88
|
+
octokit (4.21.0)
|
78
89
|
faraday (>= 0.9)
|
79
90
|
sawyer (~> 0.8.0, >= 0.5.3)
|
80
91
|
oga (2.15)
|
81
92
|
ast
|
82
93
|
ruby-ll (~> 2.1)
|
83
94
|
open4 (1.3.4)
|
84
|
-
parallel (1.
|
85
|
-
parser (
|
86
|
-
ast (~> 2.4.
|
87
|
-
pry (0.
|
88
|
-
coderay (~> 1.1
|
89
|
-
method_source (~>
|
90
|
-
public_suffix (4.0.
|
95
|
+
parallel (1.20.1)
|
96
|
+
parser (3.0.1.0)
|
97
|
+
ast (~> 2.4.1)
|
98
|
+
pry (0.14.1)
|
99
|
+
coderay (~> 1.1)
|
100
|
+
method_source (~> 1.0)
|
101
|
+
public_suffix (4.0.6)
|
91
102
|
rainbow (3.0.0)
|
92
|
-
rake (
|
93
|
-
rb-fsevent (0.10.
|
103
|
+
rake (13.0.3)
|
104
|
+
rb-fsevent (0.10.4)
|
94
105
|
rb-inotify (0.10.1)
|
95
106
|
ffi (~> 1.0)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
rspec-
|
102
|
-
|
107
|
+
rchardet (1.8.0)
|
108
|
+
regexp_parser (2.1.1)
|
109
|
+
rexml (3.2.5)
|
110
|
+
rspec (3.10.0)
|
111
|
+
rspec-core (~> 3.10.0)
|
112
|
+
rspec-expectations (~> 3.10.0)
|
113
|
+
rspec-mocks (~> 3.10.0)
|
114
|
+
rspec-core (3.10.1)
|
115
|
+
rspec-support (~> 3.10.0)
|
116
|
+
rspec-expectations (3.10.1)
|
103
117
|
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
-
rspec-support (~> 3.
|
105
|
-
rspec-mocks (3.
|
118
|
+
rspec-support (~> 3.10.0)
|
119
|
+
rspec-mocks (3.10.2)
|
106
120
|
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
-
rspec-support (~> 3.
|
108
|
-
rspec-support (3.
|
109
|
-
rubocop (
|
110
|
-
jaro_winkler (~> 1.5.1)
|
121
|
+
rspec-support (~> 3.10.0)
|
122
|
+
rspec-support (3.10.2)
|
123
|
+
rubocop (1.11.0)
|
111
124
|
parallel (~> 1.10)
|
112
|
-
parser (>=
|
125
|
+
parser (>= 3.0.0.0)
|
113
126
|
rainbow (>= 2.2.2, < 4.0)
|
127
|
+
regexp_parser (>= 1.8, < 3.0)
|
128
|
+
rexml
|
129
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
114
130
|
ruby-progressbar (~> 1.7)
|
115
|
-
unicode-display_width (>= 1.4.0, <
|
131
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
132
|
+
rubocop-ast (1.4.1)
|
133
|
+
parser (>= 2.7.1.5)
|
134
|
+
rubocop-rake (0.5.1)
|
135
|
+
rubocop
|
136
|
+
rubocop-rspec (2.2.0)
|
137
|
+
rubocop (~> 1.0)
|
138
|
+
rubocop-ast (>= 1.1.0)
|
116
139
|
ruby-ll (2.1.2)
|
117
140
|
ansi
|
118
141
|
ast
|
119
|
-
ruby-progressbar (1.
|
142
|
+
ruby-progressbar (1.11.0)
|
143
|
+
ruby2_keywords (0.0.4)
|
120
144
|
sawyer (0.8.2)
|
121
145
|
addressable (>= 2.3.5)
|
122
146
|
faraday (> 0.8, < 2.0)
|
123
147
|
shellany (0.0.1)
|
124
|
-
|
148
|
+
simplecov (0.21.2)
|
149
|
+
docile (~> 1.1)
|
150
|
+
simplecov-html (~> 0.11)
|
151
|
+
simplecov_json_formatter (~> 0.1)
|
152
|
+
simplecov-html (0.12.3)
|
153
|
+
simplecov_json_formatter (0.1.2)
|
154
|
+
terminal-table (3.0.0)
|
125
155
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
126
|
-
thor (1.0
|
127
|
-
unicode-display_width (1.
|
128
|
-
yard (0.9.
|
156
|
+
thor (1.1.0)
|
157
|
+
unicode-display_width (1.7.0)
|
158
|
+
yard (0.9.26)
|
129
159
|
|
130
160
|
PLATFORMS
|
131
161
|
ruby
|
132
162
|
|
133
163
|
DEPENDENCIES
|
134
|
-
bundler (~>
|
164
|
+
bundler (~> 2.0)
|
165
|
+
codecov (~> 0.5.1)
|
135
166
|
danger-pmd!
|
136
|
-
guard (~> 2.
|
137
|
-
guard-rspec (~> 4.7)
|
138
|
-
listen (
|
139
|
-
pry
|
140
|
-
rake (~>
|
141
|
-
rspec (~> 3.
|
142
|
-
rubocop (~> 0
|
143
|
-
|
167
|
+
guard (~> 2.16.2)
|
168
|
+
guard-rspec (~> 4.7.3)
|
169
|
+
listen (~> 3.0.8)
|
170
|
+
pry (~> 0.14.0)
|
171
|
+
rake (~> 13.0)
|
172
|
+
rspec (~> 3.10.0)
|
173
|
+
rubocop (~> 1.11.0)
|
174
|
+
rubocop-rake (~> 0.5.1)
|
175
|
+
rubocop-rspec (~> 2.2.0)
|
176
|
+
yard (~> 0.9.26)
|
144
177
|
|
145
178
|
BUNDLED WITH
|
146
|
-
|
179
|
+
2.2.14
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Mathieu Rul
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Danger PMD
|
2
|
+
[![Latest release](https://img.shields.io/github/v/release/mathroule/danger-pmd.svg)](https://github.com/mathroule/danger-pmd/releases/latest) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Deploy](https://github.com/mathroule/danger-pmd/workflows/Deploy/badge.svg)](https://github.com/mathroule/danger-pmd/actions) [![codecov](https://codecov.io/gh/mathroule/danger-pmd/branch/main/graph/badge.svg?token=HYA9XW0GL5)](https://codecov.io/gh/mathroule/danger-pmd)
|
2
3
|
|
3
|
-
|
4
|
+
Checks on your Gradle project's Java source files.
|
5
|
+
This is done using [PMD](https://pmd.github.io)
|
6
|
+
Results are passed out as tables in markdown.
|
7
|
+
|
8
|
+
This plugin is inspired from https://github.com/kazy1991/danger-findbugs.
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -12,31 +17,44 @@ Danger plugin for PMD formatted xml file. This plugin is inspired from https://g
|
|
12
17
|
your `Dangerfile` under the `pmd` namespace.
|
13
18
|
|
14
19
|
<blockquote>Running PMD with its basic configuration
|
15
|
-
<pre>
|
20
|
+
<pre>
|
21
|
+
pmd.report
|
22
|
+
</pre>
|
23
|
+
</blockquote>
|
24
|
+
|
25
|
+
<blockquote>Running PMD with a specific Gradle task or report file (glob accepted)
|
26
|
+
<pre>
|
27
|
+
pmd.gradle_task = 'module:pmd' # default: 'pmd'
|
28
|
+
pmd.report_file = 'module/build/reports/pmd/pmd.xml' # default: 'app/build/reports/pmd/pmd.xml'
|
16
29
|
pmd.report
|
17
|
-
</pre>
|
30
|
+
</pre>
|
18
31
|
</blockquote>
|
19
32
|
|
20
|
-
<blockquote>Running PMD with a specific
|
21
|
-
<pre>
|
22
|
-
pmd.
|
23
|
-
pmd.report_file = "app/build/reports/pmd/pmd.xml"
|
33
|
+
<blockquote>Running PMD with a specific root path
|
34
|
+
<pre>
|
35
|
+
pmd.root_path = '/Users/developer/project' # default: result of `git rev-parse --show-toplevel`
|
24
36
|
pmd.report
|
25
|
-
</pre>
|
37
|
+
</pre>
|
26
38
|
</blockquote>
|
27
39
|
|
28
|
-
<blockquote>Running PMD with an array of report files
|
29
|
-
<pre>
|
30
|
-
pmd.report_files = [
|
40
|
+
<blockquote>Running PMD with an array of report files (glob accepted)
|
41
|
+
<pre>
|
42
|
+
pmd.report_files = ['modules/**/build/reports/pmd/pmd.xml', 'app/build/reports/pmd/pmd.xml']
|
31
43
|
pmd.report
|
32
|
-
</pre>
|
44
|
+
</pre>
|
33
45
|
</blockquote>
|
34
46
|
|
35
47
|
<blockquote>Running PMD without running a Gradle task
|
36
|
-
<pre>
|
37
|
-
pmd.skip_gradle_task = true
|
48
|
+
<pre>
|
49
|
+
pmd.skip_gradle_task = true # default: false
|
38
50
|
pmd.report
|
39
|
-
</pre>
|
51
|
+
</pre>
|
52
|
+
</blockquote>
|
53
|
+
|
54
|
+
<blockquote>Running PMD without inline comment
|
55
|
+
<pre>
|
56
|
+
pmd.report(inline_mode: false) # default: true
|
57
|
+
</pre>
|
40
58
|
</blockquote>
|
41
59
|
|
42
60
|
#### Attributes
|
@@ -47,24 +65,26 @@ Defaults to "pmd".
|
|
47
65
|
|
48
66
|
`skip_gradle_task` - Skip Gradle task.
|
49
67
|
If you skip Gradle task, for example project does not manage Gradle.
|
68
|
+
Defaults to `false`.
|
50
69
|
|
51
|
-
`root_path` -
|
52
|
-
|
70
|
+
`root_path` - An absolute path to a root.
|
71
|
+
To comment errors to VCS, this needs to know relative path of files from the root.
|
53
72
|
Defaults to result of "git rev-parse --show-toplevel".
|
54
73
|
|
55
|
-
`report_file` - Location of report file
|
74
|
+
`report_file` - Location of report file.
|
56
75
|
If your pmd task outputs to a different location, you can specify it here.
|
57
76
|
Defaults to "app/build/reports/pmd/pmd.xml".
|
58
77
|
|
59
|
-
`report_files` - Location of report files
|
78
|
+
`report_files` - Location of report files.
|
60
79
|
If your pmd task outputs to a different location, you can specify it here.
|
61
|
-
Defaults to [
|
80
|
+
Defaults to ['app/build/reports/pmd/pmd.xml'].
|
62
81
|
|
63
82
|
#### Methods
|
64
83
|
|
65
|
-
`report` - Calls PMD task of your Gradle project
|
84
|
+
`report` - Calls PMD task of your Gradle project.
|
66
85
|
It fails if `gradlew` cannot be found inside current directory.
|
67
|
-
It fails if `report_file`
|
86
|
+
It fails if `report_file` cannot be found inside current directory.
|
87
|
+
It fails if `report_files` is empty.
|
68
88
|
|
69
89
|
`gradle_task` - A getter for `gradle_task`, returning Gradle task report.
|
70
90
|
|
data/codecov.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
codecov:
|
2
|
+
require_ci_to_pass: yes
|
3
|
+
|
4
|
+
coverage:
|
5
|
+
precision: 2
|
6
|
+
round: down
|
7
|
+
range: '70...100'
|
8
|
+
|
9
|
+
parsers:
|
10
|
+
gcov:
|
11
|
+
branch_detection:
|
12
|
+
conditional: yes
|
13
|
+
loop: yes
|
14
|
+
method: no
|
15
|
+
macro: no
|
16
|
+
|
17
|
+
comment:
|
18
|
+
layout: 'reach,diff,flags,files,footer'
|
19
|
+
behavior: default
|
20
|
+
require_changes: no
|
data/danger-pmd.gemspec
CHANGED
@@ -4,40 +4,43 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'pmd/gem_version.rb'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.description
|
12
|
-
spec.summary
|
13
|
-
spec.homepage
|
14
|
-
spec.license
|
15
|
-
|
16
|
-
spec.files
|
17
|
-
spec.executables
|
18
|
-
spec.test_files
|
7
|
+
spec.name = 'danger-pmd'
|
8
|
+
spec.version = Pmd::VERSION
|
9
|
+
spec.authors = ['Mathieu Rul']
|
10
|
+
spec.email = ['mathroule@gmail.com']
|
11
|
+
spec.description = 'A Danger plugin for PMD.'
|
12
|
+
spec.summary = 'A Danger plugin for PMD (Programming Mistake Detector), see https://pmd.github.io.'
|
13
|
+
spec.homepage = 'https://github.com/mathroule/danger-pmd'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
22
|
-
spec.add_runtime_dependency 'oga', '~> 2.
|
22
|
+
spec.add_runtime_dependency 'oga', '~> 2.15'
|
23
23
|
|
24
24
|
# General ruby development
|
25
|
-
spec.add_development_dependency 'bundler', '~>
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
26
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
27
27
|
|
28
28
|
# Testing support
|
29
|
-
spec.add_development_dependency '
|
29
|
+
spec.add_development_dependency 'codecov', '~> 0.5.1'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
30
31
|
|
31
32
|
# Linting code and docs
|
32
|
-
spec.add_development_dependency 'rubocop', '~> 0
|
33
|
-
spec.add_development_dependency '
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 1.11.0'
|
34
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5.1'
|
35
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.2.0'
|
36
|
+
spec.add_development_dependency 'yard', '~> 0.9.26'
|
34
37
|
|
35
38
|
# Makes testing easy via `bundle exec guard`
|
36
|
-
spec.add_development_dependency 'guard', '~> 2.
|
37
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
39
|
+
spec.add_development_dependency 'guard', '~> 2.16.2'
|
40
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7.3'
|
38
41
|
|
39
42
|
# If you want to work on older builds of ruby
|
40
|
-
spec.add_development_dependency 'listen', '3.0.
|
43
|
+
spec.add_development_dependency 'listen', '~> 3.0.8'
|
41
44
|
|
42
45
|
# This gives you the chance to run a REPL inside your tests
|
43
46
|
# via:
|
@@ -46,5 +49,5 @@ Gem::Specification.new do |spec|
|
|
46
49
|
# binding.pry
|
47
50
|
#
|
48
51
|
# This will stop test execution and let you inspect the results
|
49
|
-
spec.add_development_dependency 'pry'
|
52
|
+
spec.add_development_dependency 'pry', '~> 0.14.0'
|
50
53
|
end
|