danger-phpmd 0.1.1 → 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/.github/workflows/CI.yml +8 -5
- data/.github/workflows/actionlint.yml +21 -0
- data/Gemfile.lock +139 -100
- data/README.md +25 -8
- data/danger-phpmd.gemspec +2 -2
- data/lib/phpmd/gem_version.rb +1 -1
- data/lib/phpmd/plugin.rb +19 -2
- data/renovate.json +11 -0
- data/spec/phpmd_spec.rb +12 -0
- metadata +9 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ab0e7618721329c9361bb8cd717c0790ac06f7eaf4322ffcfbf740d20e66228
|
|
4
|
+
data.tar.gz: 87db1c037bc887e68e210372fe77e07d414c40463cbf7cf1c03e1863c7539a43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '01339c744a8903aeb46ad506146c3c716e2d7fffe373ec6be116cb6fb96c1b7cc8f483f7be0e379f06b27de7c516fd27e3997c64e910b597a7b8f06e5f2c84ec'
|
|
7
|
+
data.tar.gz: 26bae6dd2c54dccbdc383207c99bebb958104cd885ce86156116970b985cc1d14c99c7b39c949a5c7d951218ecfd1083b71788a94b9e8ef45b21163bc8f802e5
|
data/.github/workflows/CI.yml
CHANGED
|
@@ -8,17 +8,20 @@ jobs:
|
|
|
8
8
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
strategy:
|
|
11
|
+
fail-fast: false
|
|
11
12
|
matrix:
|
|
12
|
-
ruby-version: ['
|
|
13
|
+
ruby-version: ['3.4', '4.0']
|
|
14
|
+
php-version: ['8.3', '8.4', '8.5']
|
|
15
|
+
phpmd-version: ['2', '3']
|
|
13
16
|
|
|
14
17
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
16
19
|
- name: Setup PHP environment
|
|
17
|
-
uses: shivammathur/setup-php@v2
|
|
20
|
+
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
|
|
18
21
|
with:
|
|
19
|
-
php-version:
|
|
22
|
+
php-version: ${{ matrix.php-version }}
|
|
20
23
|
coverage: none
|
|
21
|
-
tools: phpmd
|
|
24
|
+
tools: phpmd:${{ matrix.phpmd-version }}
|
|
22
25
|
- name: Set up Ruby
|
|
23
26
|
uses: ruby/setup-ruby@v1
|
|
24
27
|
with:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: actionlint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- ".github/workflows/**"
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [main]
|
|
10
|
+
paths:
|
|
11
|
+
- ".github/workflows/**"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
actionlint:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
18
|
+
- name: Check workflow files
|
|
19
|
+
uses: docker://rhysd/actionlint:latest
|
|
20
|
+
with:
|
|
21
|
+
args: -color
|
data/Gemfile.lock
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
danger-phpmd (0.
|
|
4
|
+
danger-phpmd (0.3.0)
|
|
5
5
|
danger-plugin-api (~> 1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
activesupport (8.1.4.1)
|
|
11
|
+
base64
|
|
12
|
+
bigdecimal
|
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
14
|
+
connection_pool (>= 2.2.5)
|
|
15
|
+
drb
|
|
16
|
+
i18n (>= 1.6, < 2)
|
|
17
|
+
json
|
|
18
|
+
logger (>= 1.4.2)
|
|
19
|
+
minitest (>= 5.1)
|
|
20
|
+
securerandom (>= 0.3)
|
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
+
uri (>= 0.13.1)
|
|
23
|
+
addressable (2.9.2)
|
|
24
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
25
|
+
ast (2.4.3)
|
|
26
|
+
base64 (0.3.0)
|
|
27
|
+
bigdecimal (4.1.3)
|
|
13
28
|
claide (1.1.0)
|
|
14
29
|
claide-plugins (0.9.2)
|
|
15
30
|
cork
|
|
@@ -17,56 +32,49 @@ GEM
|
|
|
17
32
|
open4 (~> 1.3)
|
|
18
33
|
coderay (1.1.3)
|
|
19
34
|
colored2 (3.1.2)
|
|
35
|
+
concurrent-ruby (1.3.8)
|
|
36
|
+
connection_pool (3.0.2)
|
|
20
37
|
cork (0.3.0)
|
|
21
38
|
colored2 (~> 3.1)
|
|
22
|
-
danger (
|
|
39
|
+
danger (9.6.2)
|
|
40
|
+
base64 (~> 0.2)
|
|
23
41
|
claide (~> 1.0)
|
|
24
42
|
claide-plugins (>= 0.9.2)
|
|
25
|
-
colored2 (
|
|
43
|
+
colored2 (>= 3.1, < 5)
|
|
26
44
|
cork (~> 0.1)
|
|
27
|
-
faraday (>= 0.9.0, <
|
|
28
|
-
faraday-http-cache (
|
|
29
|
-
git (
|
|
30
|
-
kramdown (
|
|
45
|
+
faraday (>= 0.9.0, < 3.0)
|
|
46
|
+
faraday-http-cache (>= 2.0, < 4.0)
|
|
47
|
+
git (>= 1.13)
|
|
48
|
+
kramdown (>= 2.5.1, < 3.0)
|
|
31
49
|
kramdown-parser-gfm (~> 1.0)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
terminal-table (>= 1, <
|
|
50
|
+
octokit (>= 4.0)
|
|
51
|
+
pstore (~> 0.1)
|
|
52
|
+
terminal-table (>= 1, < 5)
|
|
35
53
|
danger-plugin-api (1.0.0)
|
|
36
54
|
danger (> 2.0)
|
|
37
|
-
diff-lcs (1.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
faraday-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
faraday-net_http (~> 1.0)
|
|
45
|
-
faraday-net_http_persistent (~> 1.0)
|
|
46
|
-
faraday-patron (~> 1.0)
|
|
47
|
-
faraday-rack (~> 1.0)
|
|
48
|
-
faraday-retry (~> 1.0)
|
|
49
|
-
ruby2_keywords (>= 0.0.4)
|
|
50
|
-
faraday-em_http (1.0.0)
|
|
51
|
-
faraday-em_synchrony (1.0.0)
|
|
52
|
-
faraday-excon (1.1.0)
|
|
53
|
-
faraday-http-cache (2.2.0)
|
|
55
|
+
diff-lcs (1.6.2)
|
|
56
|
+
drb (2.2.3)
|
|
57
|
+
faraday (2.15.1)
|
|
58
|
+
faraday-net_http (>= 2.0, < 3.6)
|
|
59
|
+
json
|
|
60
|
+
logger
|
|
61
|
+
faraday-http-cache (3.0.0)
|
|
54
62
|
faraday (>= 0.8)
|
|
55
|
-
faraday-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
guard (2.18.0)
|
|
63
|
+
faraday-net_http (3.5.0)
|
|
64
|
+
net-http (~> 0.5)
|
|
65
|
+
ffi (1.17.4)
|
|
66
|
+
formatador (1.2.3)
|
|
67
|
+
reline
|
|
68
|
+
git (6.0.0)
|
|
69
|
+
activesupport (>= 7.0.9)
|
|
70
|
+
addressable (~> 2.9)
|
|
71
|
+
logger (~> 1.6)
|
|
72
|
+
process_executer (~> 4.1)
|
|
73
|
+
rchardet (~> 1.9)
|
|
74
|
+
guard (2.20.2)
|
|
68
75
|
formatador (>= 0.2.4)
|
|
69
76
|
listen (>= 2.7, < 4.0)
|
|
77
|
+
logger (~> 1.6)
|
|
70
78
|
lumberjack (>= 1.0.12, < 2.0)
|
|
71
79
|
nenv (~> 0.1)
|
|
72
80
|
notiffany (~> 0.0)
|
|
@@ -78,88 +86,119 @@ GEM
|
|
|
78
86
|
guard (~> 2.1)
|
|
79
87
|
guard-compat (~> 1.1)
|
|
80
88
|
rspec (>= 2.99.0, < 4.0)
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
i18n (1.15.2)
|
|
90
|
+
concurrent-ruby (~> 1.0)
|
|
91
|
+
io-console (0.9.5)
|
|
92
|
+
json (3.1.0)
|
|
93
|
+
kramdown (2.5.2)
|
|
94
|
+
rexml (>= 3.4.4)
|
|
83
95
|
kramdown-parser-gfm (1.1.0)
|
|
84
96
|
kramdown (~> 2.0)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
language_server-protocol (3.17.0.6)
|
|
98
|
+
lint_roller (1.1.0)
|
|
99
|
+
listen (3.10.1)
|
|
100
|
+
logger
|
|
101
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
102
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
103
|
+
logger (1.7.0)
|
|
104
|
+
lumberjack (1.4.2)
|
|
105
|
+
method_source (1.1.0)
|
|
106
|
+
minitest (6.1.0)
|
|
107
|
+
drb (~> 2.0)
|
|
108
|
+
prism (>= 1.5, < 3)
|
|
109
|
+
nap (1.2.0)
|
|
92
110
|
nenv (0.3.0)
|
|
93
|
-
|
|
111
|
+
net-http (0.10.0)
|
|
112
|
+
net-protocol (>= 0.3.0)
|
|
113
|
+
uri (>= 0.11.1)
|
|
114
|
+
net-protocol (0.4.0)
|
|
115
|
+
timeout
|
|
94
116
|
notiffany (0.1.3)
|
|
95
117
|
nenv (~> 0.1)
|
|
96
118
|
shellany (~> 0.0)
|
|
97
|
-
octokit (
|
|
98
|
-
faraday (>=
|
|
99
|
-
sawyer (~> 0.
|
|
119
|
+
octokit (10.0.0)
|
|
120
|
+
faraday (>= 1, < 3)
|
|
121
|
+
sawyer (~> 0.9)
|
|
100
122
|
open4 (1.3.4)
|
|
101
|
-
parallel (
|
|
102
|
-
parser (3.
|
|
123
|
+
parallel (2.3.0)
|
|
124
|
+
parser (3.3.13.0)
|
|
103
125
|
ast (~> 2.4.1)
|
|
104
|
-
|
|
126
|
+
racc
|
|
127
|
+
prism (2.1.0)
|
|
128
|
+
process_executer (4.1.1)
|
|
129
|
+
track_open_instances (~> 0.1)
|
|
130
|
+
pry (0.16.1)
|
|
105
131
|
coderay (~> 1.1)
|
|
106
132
|
method_source (~> 1.0)
|
|
107
|
-
|
|
133
|
+
reline (>= 0.6.0)
|
|
134
|
+
pstore (0.3.0)
|
|
135
|
+
public_suffix (7.0.5)
|
|
136
|
+
racc (1.8.1)
|
|
108
137
|
rainbow (3.1.1)
|
|
109
|
-
rake (13.
|
|
110
|
-
rb-fsevent (0.11.
|
|
111
|
-
rb-inotify (0.
|
|
138
|
+
rake (13.4.2)
|
|
139
|
+
rb-fsevent (0.11.2)
|
|
140
|
+
rb-inotify (0.11.1)
|
|
112
141
|
ffi (~> 1.0)
|
|
113
|
-
rchardet (1.
|
|
114
|
-
regexp_parser (2.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
rspec-
|
|
120
|
-
|
|
121
|
-
rspec-
|
|
122
|
-
rspec-
|
|
142
|
+
rchardet (1.10.2)
|
|
143
|
+
regexp_parser (2.13.1)
|
|
144
|
+
reline (0.7.0)
|
|
145
|
+
io-console (~> 0.5)
|
|
146
|
+
rexml (3.4.4)
|
|
147
|
+
rspec (3.13.2)
|
|
148
|
+
rspec-core (~> 3.13.0)
|
|
149
|
+
rspec-expectations (~> 3.13.0)
|
|
150
|
+
rspec-mocks (~> 3.13.0)
|
|
151
|
+
rspec-core (3.13.7)
|
|
152
|
+
rspec-support (~> 3.13.0)
|
|
153
|
+
rspec-expectations (3.13.6)
|
|
123
154
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
124
|
-
rspec-support (~> 3.
|
|
125
|
-
rspec-mocks (3.
|
|
155
|
+
rspec-support (~> 3.13.0)
|
|
156
|
+
rspec-mocks (3.13.9)
|
|
126
157
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
127
|
-
rspec-support (~> 3.
|
|
128
|
-
rspec-support (3.
|
|
129
|
-
rubocop (1.
|
|
130
|
-
|
|
131
|
-
|
|
158
|
+
rspec-support (~> 3.13.0)
|
|
159
|
+
rspec-support (3.13.8)
|
|
160
|
+
rubocop (1.92.2)
|
|
161
|
+
json (>= 2.3)
|
|
162
|
+
language_server-protocol (~> 3.17.0.2)
|
|
163
|
+
lint_roller (~> 1.1.0)
|
|
164
|
+
parallel (>= 1.10)
|
|
165
|
+
parser (>= 3.3.0.2)
|
|
132
166
|
rainbow (>= 2.2.2, < 4.0)
|
|
133
|
-
regexp_parser (>=
|
|
134
|
-
|
|
135
|
-
rubocop-ast (>= 1.17.0, < 2.0)
|
|
167
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
168
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
136
169
|
ruby-progressbar (~> 1.7)
|
|
137
|
-
unicode-display_width (>=
|
|
138
|
-
rubocop-ast (1.
|
|
139
|
-
parser (>= 3.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
sawyer (0.
|
|
170
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
171
|
+
rubocop-ast (1.51.0)
|
|
172
|
+
parser (>= 3.3.7.2)
|
|
173
|
+
prism (>= 1.7)
|
|
174
|
+
ruby-progressbar (1.13.0)
|
|
175
|
+
sawyer (0.9.3)
|
|
143
176
|
addressable (>= 2.3.5)
|
|
144
|
-
faraday (
|
|
177
|
+
faraday (>= 0.17.3, < 3)
|
|
178
|
+
securerandom (0.4.1)
|
|
145
179
|
shellany (0.0.1)
|
|
146
|
-
terminal-table (
|
|
147
|
-
unicode-display_width (>= 1.1.1, <
|
|
148
|
-
thor (1.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
180
|
+
terminal-table (4.0.0)
|
|
181
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
182
|
+
thor (1.5.0)
|
|
183
|
+
timeout (0.6.1)
|
|
184
|
+
track_open_instances (0.1.15)
|
|
185
|
+
tzinfo (2.0.6)
|
|
186
|
+
concurrent-ruby (~> 1.0)
|
|
187
|
+
unicode-display_width (3.3.0)
|
|
188
|
+
unicode-emoji (~> 4.3)
|
|
189
|
+
unicode-emoji (4.3.0)
|
|
190
|
+
uri (1.1.2)
|
|
191
|
+
yard (0.9.45)
|
|
153
192
|
|
|
154
193
|
PLATFORMS
|
|
155
194
|
ruby
|
|
156
195
|
|
|
157
196
|
DEPENDENCIES
|
|
158
|
-
bundler (~>
|
|
197
|
+
bundler (~> 4.0)
|
|
159
198
|
danger-phpmd!
|
|
160
199
|
guard (~> 2.14)
|
|
161
200
|
guard-rspec (~> 4.7)
|
|
162
|
-
listen (= 3.
|
|
201
|
+
listen (= 3.10.1)
|
|
163
202
|
pry
|
|
164
203
|
rake (~> 13.0)
|
|
165
204
|
rspec (~> 3.4)
|
|
@@ -167,4 +206,4 @@ DEPENDENCIES
|
|
|
167
206
|
yard
|
|
168
207
|
|
|
169
208
|
BUNDLED WITH
|
|
170
|
-
|
|
209
|
+
4.0.24
|
data/README.md
CHANGED
|
@@ -13,17 +13,35 @@ Please check the [installation guide](https://phpmd.org/download/index.html).
|
|
|
13
13
|
|
|
14
14
|
Add this to Dangerfile.
|
|
15
15
|
|
|
16
|
+
```ruby
|
|
17
|
+
phpmd.run
|
|
16
18
|
```
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
PHPMD 3 automatically detects a configuration file (`phpmd.yml`, `phpmd.xml`, etc.) in the current directory.
|
|
21
|
+
If you want to specify rulesets, pass them to the `ruleset` option. Multiple rulesets can be separated by comma.
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
phpmd.run ruleset: "phpmd.yml"
|
|
25
|
+
phpmd.run ruleset: "cleancode,codesize"
|
|
18
26
|
```
|
|
19
27
|
|
|
20
28
|
If you want to specify phpmd bin file, you can set a bin path to the binary_path parameter.
|
|
21
29
|
|
|
22
|
-
```
|
|
30
|
+
```ruby
|
|
23
31
|
phpmd.binary_path = "vendor/bin/phpmd"
|
|
24
|
-
phpmd.run
|
|
32
|
+
phpmd.run
|
|
25
33
|
```
|
|
26
34
|
|
|
35
|
+
If phpmd fails (e.g. invalid ruleset), an error is raised with the output of phpmd.
|
|
36
|
+
|
|
37
|
+
### PHPMD 2
|
|
38
|
+
|
|
39
|
+
PHPMD 2 is also supported. The version is detected automatically.
|
|
40
|
+
The `ruleset` option is required for PHPMD 2.
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
phpmd.run ruleset: "rulesets.xml"
|
|
44
|
+
```
|
|
27
45
|
|
|
28
46
|
### GitHub actions
|
|
29
47
|
|
|
@@ -37,21 +55,20 @@ jobs:
|
|
|
37
55
|
runs-on: ubuntu-latest
|
|
38
56
|
if: github.event_name == 'pull_request'
|
|
39
57
|
steps:
|
|
40
|
-
- uses: actions/checkout@
|
|
58
|
+
- uses: actions/checkout@v6
|
|
41
59
|
- uses: ruby/setup-ruby@v1
|
|
42
60
|
with:
|
|
43
|
-
ruby-version:
|
|
61
|
+
ruby-version: 3.4
|
|
44
62
|
bundler-cache: true
|
|
45
63
|
|
|
46
64
|
- name: Setup PHP environment
|
|
47
65
|
uses: shivammathur/setup-php@v2
|
|
48
66
|
with:
|
|
49
|
-
php-version: '8.
|
|
67
|
+
php-version: '8.4'
|
|
50
68
|
coverage: none
|
|
51
|
-
tools: phpmd
|
|
69
|
+
tools: phpmd:3
|
|
52
70
|
|
|
53
71
|
- run: bundle exec danger
|
|
54
72
|
env:
|
|
55
73
|
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
56
74
|
```
|
|
57
|
-
|
data/danger-phpmd.gemspec
CHANGED
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
|
|
23
23
|
|
|
24
24
|
# General ruby development
|
|
25
|
-
spec.add_development_dependency "bundler", "~>
|
|
25
|
+
spec.add_development_dependency "bundler", "~> 4.0"
|
|
26
26
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
27
27
|
|
|
28
28
|
# Testing support
|
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
|
38
38
|
|
|
39
39
|
# If you want to work on older builds of ruby
|
|
40
|
-
spec.add_development_dependency "listen", "3.
|
|
40
|
+
spec.add_development_dependency "listen", "3.10.1"
|
|
41
41
|
|
|
42
42
|
# This gives you the chance to run a REPL inside your tests
|
|
43
43
|
# via:
|
data/lib/phpmd/gem_version.rb
CHANGED
data/lib/phpmd/plugin.rb
CHANGED
|
@@ -21,11 +21,13 @@ module Danger
|
|
|
21
21
|
|
|
22
22
|
# Execute phpmd
|
|
23
23
|
# @return [void]
|
|
24
|
-
def run(options)
|
|
24
|
+
def run(options = {})
|
|
25
25
|
return if target_files.empty?
|
|
26
26
|
|
|
27
27
|
tmpfile = Tempfile.open("phpmd_result")
|
|
28
|
-
Open3.capture3(
|
|
28
|
+
_stdout, stderr, status = Open3.capture3(*command(tmpfile.path, options[:ruleset]))
|
|
29
|
+
raise "phpmd failed: #{stderr}" unless [0, 2].include?(status.exitstatus)
|
|
30
|
+
|
|
29
31
|
results = parse(tmpfile.read)
|
|
30
32
|
results.each do |result|
|
|
31
33
|
warn(result[:message], file: result[:file], line: result[:line])
|
|
@@ -34,6 +36,21 @@ module Danger
|
|
|
34
36
|
|
|
35
37
|
private
|
|
36
38
|
|
|
39
|
+
def command(report_path, ruleset)
|
|
40
|
+
if major_version >= 3
|
|
41
|
+
rulesets = ruleset.to_s.split(",").flat_map { |r| ["--ruleset", r] }
|
|
42
|
+
[cmd_path, "analyze", "--format", "json", "--reportfile-json", report_path, "--no-progress", *rulesets, "--", *target_files]
|
|
43
|
+
else
|
|
44
|
+
[cmd_path, "--reportfile", report_path, target_files.join(","), "json", ruleset]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def major_version
|
|
49
|
+
stdout, _stderr, _status = Open3.capture3(cmd_path, "--version")
|
|
50
|
+
match = stdout.match(/PHPMD (\d+)\./)
|
|
51
|
+
match ? match[1].to_i : 3
|
|
52
|
+
end
|
|
53
|
+
|
|
37
54
|
def cmd_path
|
|
38
55
|
return binary_path if binary_path
|
|
39
56
|
|
data/renovate.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": ["config:recommended", "helpers:pinGitHubActionDigests"],
|
|
4
|
+
"packageRules": [
|
|
5
|
+
{
|
|
6
|
+
"minimumReleaseAge": "1 week",
|
|
7
|
+
"internalChecksFilter": "strict",
|
|
8
|
+
"matchPackageNames": ["*"]
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
data/spec/phpmd_spec.rb
CHANGED
|
@@ -47,6 +47,18 @@ module Danger
|
|
|
47
47
|
expect(violation_report.message).to eq(expected_message)
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
context "with an unknown ruleset" do
|
|
52
|
+
before do
|
|
53
|
+
allow(@my_plugin).to receive(:target_files).and_return(
|
|
54
|
+
[File.expand_path("fixtures/no_warnings.php", __dir__)]
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "raises an error" do
|
|
59
|
+
expect { @my_plugin.run({ ruleset: "unknown" }) }.to raise_error(/phpmd failed/)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
50
62
|
end
|
|
51
63
|
end
|
|
52
64
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-phpmd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kyosuke Takayama
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: danger-plugin-api
|
|
@@ -30,14 +29,14 @@ dependencies:
|
|
|
30
29
|
requirements:
|
|
31
30
|
- - "~>"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
32
|
+
version: '4.0'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - "~>"
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
39
|
+
version: '4.0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
41
|
name: rake
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,14 +127,14 @@ dependencies:
|
|
|
128
127
|
requirements:
|
|
129
128
|
- - '='
|
|
130
129
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 3.
|
|
130
|
+
version: 3.10.1
|
|
132
131
|
type: :development
|
|
133
132
|
prerelease: false
|
|
134
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
134
|
requirements:
|
|
136
135
|
- - '='
|
|
137
136
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 3.
|
|
137
|
+
version: 3.10.1
|
|
139
138
|
- !ruby/object:Gem::Dependency
|
|
140
139
|
name: pry
|
|
141
140
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -158,6 +157,7 @@ extensions: []
|
|
|
158
157
|
extra_rdoc_files: []
|
|
159
158
|
files:
|
|
160
159
|
- ".github/workflows/CI.yml"
|
|
160
|
+
- ".github/workflows/actionlint.yml"
|
|
161
161
|
- ".gitignore"
|
|
162
162
|
- ".rubocop.yml"
|
|
163
163
|
- Gemfile
|
|
@@ -171,6 +171,7 @@ files:
|
|
|
171
171
|
- lib/danger_plugin.rb
|
|
172
172
|
- lib/phpmd/gem_version.rb
|
|
173
173
|
- lib/phpmd/plugin.rb
|
|
174
|
+
- renovate.json
|
|
174
175
|
- spec/fixtures/cleancode_warnings.php
|
|
175
176
|
- spec/fixtures/no_warnings.php
|
|
176
177
|
- spec/phpmd_spec.rb
|
|
@@ -179,7 +180,6 @@ homepage: https://github.com/ktakayama/danger-phpmd
|
|
|
179
180
|
licenses:
|
|
180
181
|
- MIT
|
|
181
182
|
metadata: {}
|
|
182
|
-
post_install_message:
|
|
183
183
|
rdoc_options: []
|
|
184
184
|
require_paths:
|
|
185
185
|
- lib
|
|
@@ -194,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
194
194
|
- !ruby/object:Gem::Version
|
|
195
195
|
version: '0'
|
|
196
196
|
requirements: []
|
|
197
|
-
rubygems_version:
|
|
198
|
-
signing_key:
|
|
197
|
+
rubygems_version: 4.0.10
|
|
199
198
|
specification_version: 4
|
|
200
199
|
summary: Danger plugin for PHPMD.
|
|
201
200
|
test_files:
|