Class: Pronto::Credo::Wrapper
- Inherits:
-
Object
- Object
- Pronto::Credo::Wrapper
- Defined in:
- lib/pronto/credo/wrapper.rb
Instance Attribute Summary collapse
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Instance Method Summary collapse
-
#initialize(patch) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #lint ⇒ Object
Constructor Details
#initialize(patch) ⇒ Wrapper
Returns a new instance of Wrapper.
9 10 11 |
# File 'lib/pronto/credo/wrapper.rb', line 9 def initialize(patch) @patch = patch end |
Instance Attribute Details
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
7 8 9 |
# File 'lib/pronto/credo/wrapper.rb', line 7 def patch @patch end |
Instance Method Details
#lint ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pronto/credo/wrapper.rb', line 13 def lint return [] if patch.nil? path = patch.delta.new_file[:path] stdout, stderr, _ = Open3.capture3(credo_executable(path)) puts "WARN: pronto-credo: #{stderr}" if stderr && stderr.size > 0 return {} if stdout.nil? || stdout == 0 OutputParser.new(path, stdout).parse end |