danger-phpmd 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2efd89cd349c6125c7d8084c72c6c8a162dd8bd2411b19162275cff1c2ccecc9
4
- data.tar.gz: d32b6626f470ac5b1627a4e41c0173cff7edbef9d2752fca301085bb89159732
3
+ metadata.gz: ffcc9bbb3430591e317b9658c345762973fcfa71dea588fc4367889d9fc6849c
4
+ data.tar.gz: 79a4c2d9a824076acc4856c1ff76b10095a87a179a93ac8c77dad6f92a16e920
5
5
  SHA512:
6
- metadata.gz: 7332d278d2bdb0051ec433b2987f75a13f982bdf977f80a41d3b354fb811f1eaa6864293ccdc9d82fbc00bd71673771385ddd9623f93b42051ff778d2cefcfa9
7
- data.tar.gz: f649bb361c793116c79e175be9f939b3fad953cfe33f431e354a92d6c420270ea27949a09319471a5c8e5c5298cbb1d4864439c78f6b7fcde7e485837f895613
6
+ metadata.gz: 1f0f2979a8ce2b05c9d86b0624e74b2aa084397b6031ac3b981bec66931ec5250d27ba652f22746bd55b925dd920a2e7cf96344142989dc411bc0a12ee0a9a94
7
+ data.tar.gz: 49dfc1ae3e7c88602247dfcd1f267c09e36d3dcac52a45e6a75eb438518b42d43121a740268b7a7a736ea3615c73d8d4397a343fab0ab1308dde1a4cd58d8409
data/README.md CHANGED
@@ -10,9 +10,8 @@
10
10
 
11
11
  <blockquote>Run phpmd and send warn comment.
12
12
  <pre>
13
- phpmd.phpmd_path = "vendor/bin/phpmd"
14
- phpmd.config_path = "rulesets.xml"
15
- phpmd.run
13
+ phpmd.binary_path = "vendor/bin/phpmd"
14
+ phpmd.run ruleset: "rulesets.xml"
16
15
  </pre>
17
16
  </blockquote>
18
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phpmd
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
data/lib/phpmd/plugin.rb CHANGED
@@ -8,9 +8,8 @@ module Danger
8
8
  #
9
9
  # @example Run phpmd and send warn comment.
10
10
  #
11
- # phpmd.phpmd_path = "vendor/bin/phpmd"
12
- # phpmd.config_path = "rulesets.xml"
13
- # phpmd.run
11
+ # phpmd.binary_path = "vendor/bin/phpmd"
12
+ # phpmd.run ruleset: "rulesets.xml"
14
13
  #
15
14
  # @see ktakayama/danger-phpmd
16
15
  # @tags phpmd
@@ -18,18 +17,14 @@ module Danger
18
17
  class DangerPhpmd < Plugin
19
18
  # phpmd path
20
19
  # @return [String]
21
- attr_accessor :phpmd_path
22
-
23
- # phpmd.xml path
24
- # @return [String]
25
- attr_accessor :config_path
20
+ attr_accessor :binary_path
26
21
 
27
22
  # Execute phpmd
28
23
  # @return [void]
29
- def run
24
+ def run(options)
30
25
  return if target_files.empty?
31
- cmd = phpmd_path || "phpmd"
32
- json,e,s = Open3.capture3(cmd, target_files.join(","), "json", config_path)
26
+ cmd = binary_path || "phpmd"
27
+ json,e,s = Open3.capture3(cmd, target_files.join(","), "json", options[:ruleset])
33
28
  results = parse(json)
34
29
  results.each do |result|
35
30
  warn(result[:message], file: result[:file], line: result[:line])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-phpmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyosuke Takayama