Class: Danger::DangerPhpmd
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerPhpmd
- Defined in:
- lib/phpmd/plugin.rb
Overview
[Danger](danger.systems/ruby/) plugin for [phpmd](phpmd.org/).
Instance Attribute Summary collapse
-
#binary_path ⇒ String
phpmd path.
Instance Method Summary collapse
-
#run(options) ⇒ void
Execute phpmd.
Instance Attribute Details
#binary_path ⇒ String
phpmd path
20 21 22 |
# File 'lib/phpmd/plugin.rb', line 20 def binary_path @binary_path end |
Instance Method Details
#run(options) ⇒ void
This method returns an undefined value.
Execute phpmd
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/phpmd/plugin.rb', line 24 def run() return if target_files.empty? tmpfile = Tempfile.open("phpmd_result") Open3.capture3(cmd_path, "--reportfile", tmpfile.path, target_files.join(","), "json", [:ruleset]) results = parse(tmpfile.read) results.each do |result| warn(result[:message], file: result[:file], line: result[:line]) end end |