danger-pmd 0.3.0 → 1.0.4
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 +93 -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 +5 -4
- 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.4)
|
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,47 @@ 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.1)
|
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.3.0)
|
44
|
+
faraday-net_http (~> 1.0)
|
41
45
|
multipart-post (>= 1.2, < 3)
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
ruby2_keywords
|
47
|
+
faraday-http-cache (2.2.0)
|
48
|
+
faraday (>= 0.8)
|
49
|
+
faraday-net_http (1.0.1)
|
50
|
+
ffi (1.15.0)
|
45
51
|
formatador (0.2.5)
|
46
|
-
git (1.
|
47
|
-
|
52
|
+
git (1.8.1)
|
53
|
+
rchardet (~> 1.8)
|
54
|
+
guard (2.16.2)
|
48
55
|
formatador (>= 0.2.4)
|
49
56
|
listen (>= 2.7, < 4.0)
|
50
57
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -58,15 +65,15 @@ GEM
|
|
58
65
|
guard (~> 2.1)
|
59
66
|
guard-compat (~> 1.1)
|
60
67
|
rspec (>= 2.99.0, < 4.0)
|
61
|
-
|
62
|
-
|
68
|
+
kramdown (2.3.1)
|
69
|
+
rexml
|
63
70
|
kramdown-parser-gfm (1.1.0)
|
64
71
|
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.
|
72
|
+
listen (3.0.8)
|
73
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
74
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
75
|
+
lumberjack (1.2.8)
|
76
|
+
method_source (1.0.0)
|
70
77
|
multipart-post (2.1.1)
|
71
78
|
nap (1.1.0)
|
72
79
|
nenv (0.3.0)
|
@@ -74,72 +81,95 @@ GEM
|
|
74
81
|
notiffany (0.1.3)
|
75
82
|
nenv (~> 0.1)
|
76
83
|
shellany (~> 0.0)
|
77
|
-
octokit (4.
|
84
|
+
octokit (4.20.0)
|
85
|
+
faraday (>= 0.9)
|
78
86
|
sawyer (~> 0.8.0, >= 0.5.3)
|
79
87
|
oga (2.15)
|
80
88
|
ast
|
81
89
|
ruby-ll (~> 2.1)
|
82
90
|
open4 (1.3.4)
|
83
|
-
parallel (1.
|
84
|
-
parser (
|
85
|
-
ast (~> 2.4.
|
86
|
-
pry (0.
|
87
|
-
coderay (~> 1.1
|
88
|
-
method_source (~>
|
89
|
-
public_suffix (4.0.
|
91
|
+
parallel (1.20.1)
|
92
|
+
parser (3.0.0.0)
|
93
|
+
ast (~> 2.4.1)
|
94
|
+
pry (0.14.0)
|
95
|
+
coderay (~> 1.1)
|
96
|
+
method_source (~> 1.0)
|
97
|
+
public_suffix (4.0.6)
|
90
98
|
rainbow (3.0.0)
|
91
|
-
rake (
|
92
|
-
rb-fsevent (0.10.
|
99
|
+
rake (13.0.3)
|
100
|
+
rb-fsevent (0.10.4)
|
93
101
|
rb-inotify (0.10.1)
|
94
102
|
ffi (~> 1.0)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
rspec-
|
101
|
-
|
103
|
+
rchardet (1.8.0)
|
104
|
+
regexp_parser (2.1.1)
|
105
|
+
rexml (3.2.4)
|
106
|
+
rspec (3.10.0)
|
107
|
+
rspec-core (~> 3.10.0)
|
108
|
+
rspec-expectations (~> 3.10.0)
|
109
|
+
rspec-mocks (~> 3.10.0)
|
110
|
+
rspec-core (3.10.1)
|
111
|
+
rspec-support (~> 3.10.0)
|
112
|
+
rspec-expectations (3.10.1)
|
102
113
|
diff-lcs (>= 1.2.0, < 2.0)
|
103
|
-
rspec-support (~> 3.
|
104
|
-
rspec-mocks (3.
|
114
|
+
rspec-support (~> 3.10.0)
|
115
|
+
rspec-mocks (3.10.2)
|
105
116
|
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
-
rspec-support (~> 3.
|
107
|
-
rspec-support (3.
|
108
|
-
rubocop (
|
109
|
-
jaro_winkler (~> 1.5.1)
|
117
|
+
rspec-support (~> 3.10.0)
|
118
|
+
rspec-support (3.10.2)
|
119
|
+
rubocop (1.11.0)
|
110
120
|
parallel (~> 1.10)
|
111
|
-
parser (>=
|
121
|
+
parser (>= 3.0.0.0)
|
112
122
|
rainbow (>= 2.2.2, < 4.0)
|
123
|
+
regexp_parser (>= 1.8, < 3.0)
|
124
|
+
rexml
|
125
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
113
126
|
ruby-progressbar (~> 1.7)
|
114
|
-
unicode-display_width (>= 1.4.0, <
|
127
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
128
|
+
rubocop-ast (1.4.1)
|
129
|
+
parser (>= 2.7.1.5)
|
130
|
+
rubocop-rake (0.5.1)
|
131
|
+
rubocop
|
132
|
+
rubocop-rspec (2.2.0)
|
133
|
+
rubocop (~> 1.0)
|
134
|
+
rubocop-ast (>= 1.1.0)
|
115
135
|
ruby-ll (2.1.2)
|
116
136
|
ansi
|
117
137
|
ast
|
118
|
-
ruby-progressbar (1.
|
138
|
+
ruby-progressbar (1.11.0)
|
139
|
+
ruby2_keywords (0.0.4)
|
119
140
|
sawyer (0.8.2)
|
120
141
|
addressable (>= 2.3.5)
|
121
142
|
faraday (> 0.8, < 2.0)
|
122
143
|
shellany (0.0.1)
|
123
|
-
|
144
|
+
simplecov (0.21.2)
|
145
|
+
docile (~> 1.1)
|
146
|
+
simplecov-html (~> 0.11)
|
147
|
+
simplecov_json_formatter (~> 0.1)
|
148
|
+
simplecov-html (0.12.3)
|
149
|
+
simplecov_json_formatter (0.1.2)
|
150
|
+
terminal-table (3.0.0)
|
124
151
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
125
|
-
thor (1.0
|
126
|
-
unicode-display_width (1.
|
127
|
-
yard (0.9.
|
152
|
+
thor (1.1.0)
|
153
|
+
unicode-display_width (1.7.0)
|
154
|
+
yard (0.9.26)
|
128
155
|
|
129
156
|
PLATFORMS
|
130
157
|
ruby
|
131
158
|
|
132
159
|
DEPENDENCIES
|
133
|
-
bundler (~>
|
160
|
+
bundler (~> 2.0)
|
161
|
+
codecov (~> 0.5.1)
|
134
162
|
danger-pmd!
|
135
|
-
guard (~> 2.
|
136
|
-
guard-rspec (~> 4.7)
|
137
|
-
listen (
|
138
|
-
pry
|
139
|
-
rake (~>
|
140
|
-
rspec (~> 3.
|
141
|
-
rubocop (~> 0
|
142
|
-
|
163
|
+
guard (~> 2.16.2)
|
164
|
+
guard-rspec (~> 4.7.3)
|
165
|
+
listen (~> 3.0.8)
|
166
|
+
pry (~> 0.14.0)
|
167
|
+
rake (~> 13.0)
|
168
|
+
rspec (~> 3.10.0)
|
169
|
+
rubocop (~> 1.11.0)
|
170
|
+
rubocop-rake (~> 0.5.1)
|
171
|
+
rubocop-rspec (~> 2.2.0)
|
172
|
+
yard (~> 0.9.26)
|
143
173
|
|
144
174
|
BUNDLED WITH
|
145
|
-
|
175
|
+
2.2.14
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Mathieu Rul <mathroule@gmail.com>
|
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) [![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
|