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.



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

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

Instance Attribute Details

#problemsObject (readonly)

Returns the value of attribute problems.



3
4
5
# File 'lib/pippi/report.rb', line 3

def problems
  @problems
end

#removedObject (readonly)

Returns the value of attribute removed.



3
4
5
# File 'lib/pippi/report.rb', line 3

def removed
  @removed
end

Instance Method Details

#add(problem) ⇒ Object



10
11
12
# File 'lib/pippi/report.rb', line 10

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

#remove(lineno, path, clazz) ⇒ Object



14
15
16
17
# File 'lib/pippi/report.rb', line 14

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