Class: Pippi::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/pippi/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



7
8
9
10
# File 'lib/pippi/report.rb', line 7

def initialize
  @problems = []
  @removed = Set.new
end

Instance Attribute Details

#problemsObject (readonly)

Returns the value of attribute problems.



5
6
7
# File 'lib/pippi/report.rb', line 5

def problems
  @problems
end

#removedObject (readonly)

Returns the value of attribute removed.



5
6
7
# File 'lib/pippi/report.rb', line 5

def removed
  @removed
end

Instance Method Details

#add(problem) ⇒ Object



12
13
14
# File 'lib/pippi/report.rb', line 12

def add(problem)
  @problems << problem unless duplicate_report?(problem) || already_removed?(problem)
end

#remove(lineno, path, clazz) ⇒ Object



16
17
18
19
# File 'lib/pippi/report.rb', line 16

def remove(lineno, path, clazz)
  @removed << Pippi::Problem.new(:line_number => lineno, :file_path => path, :check_class => clazz).to_s
  @problems.reject! { |p| p.line_number == lineno && p.file_path == path && p.check_class == clazz }
end