Class: Pronto::Yard::YardJunkWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/yard/yard_junk_wrapper.rb

Overview

Wrapper to run and collect errors from YardJunk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ YardJunkWrapper

Returns a new instance of YardJunkWrapper.

Parameters:

  • path (String)

    The file's path to run yard report


11
12
13
14
# File 'lib/pronto/yard/yard_junk_wrapper.rb', line 11

def initialize(path:)
  @path = path
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.


8
9
10
# File 'lib/pronto/yard/yard_junk_wrapper.rb', line 8

def errors
  @errors
end

Instance Method Details

#runArray

Return an array of yard errors

Returns:

  • (Array)

    Return an array of yard errors


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pronto/yard/yard_junk_wrapper.rb', line 17

def run
  # Run in the context of the repo's path
  Dir.chdir(path) do
    # YardJunk outputs its version number and other things via `puts`
    silent do
      YardJunk::Janitor.new.run.report(:pronto, pronto: [errors])
    end
  end

  errors
end