Class: Fasterer::Github::OutputComposer

Inherits:
Object
  • Object
show all
Defined in:
lib/fasterer/github/output_composer.rb

Constant Summary collapse

CONFIG_FILE_NAME =
'.fasterer.yml'
SPEEDUPS_KEY =
'speedups'

Instance Method Summary collapse

Constructor Details

#initialize(owner, repo, ignored_offences) ⇒ OutputComposer

Returns a new instance of OutputComposer.



8
9
10
11
12
# File 'lib/fasterer/github/output_composer.rb', line 8

def initialize(owner, repo, ignored_offences)
  @repo_owner = owner
  @repo_name = repo
  @ignored_offences = ignored_offences
end

Instance Method Details

#add_api_errors(new_api_errors) ⇒ Object



26
27
28
# File 'lib/fasterer/github/output_composer.rb', line 26

def add_api_errors(new_api_errors)
  new_api_errors.each { |e| api_errors << e }
end

#add_errors(path) ⇒ Object



22
23
24
# File 'lib/fasterer/github/output_composer.rb', line 22

def add_errors(path)
  errors << { path: path }
end

#add_offences(offences, path) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/fasterer/github/output_composer.rb', line 14

def add_offences(offences, path)
  offences.each do |offence_name, lines|
    details = { path: path, lines: lines }
    next if ignored_offences.include?(offence_name)
    (fasterer_offences[offence_name] ||= []) << details
  end
end

#resultObject



30
31
32
33
34
35
36
37
38
# File 'lib/fasterer/github/output_composer.rb', line 30

def result
  {
    repo_owner: repo_owner,
    repo_name: repo_name,
    fasterer_offences: fasterer_offences,
    errors: errors,
    api_errors: api_errors
  }
end