lib/rubocop/report/report.rb in rubocop-0.3.1 vs lib/rubocop/report/report.rb in rubocop-0.3.2
- old
+ new
@@ -14,12 +14,11 @@
end
module_function :create
class Report
- attr_accessor :entries
- attr_accessor :filename
+ attr_reader :filename
# @param [String] the filename for this report
def initialize(filename)
@filename = filename
@entries = []
@@ -29,9 +28,13 @@
# @param [Cop] a cop with something to report
def <<(cop)
cop.offences.each do |entry|
@entries << entry
end
+ end
+
+ def entries
+ @entries.sort_by(&:line_number)
end
def empty?
entries.empty?
end