Class: RuboBot::RuboCop::Offenses
- Inherits:
-
Object
- Object
- RuboBot::RuboCop::Offenses
- Defined in:
- lib/rubobot/rubocop/offenses.rb
Overview
Offenses found by a RuboCop run
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(paths) ⇒ Offenses
constructor
A new instance of Offenses.
- #next ⇒ Object
- #size ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(paths) ⇒ Offenses
Returns a new instance of Offenses.
10 11 12 13 14 15 16 17 |
# File 'lib/rubobot/rubocop/offenses.rb', line 10 def initialize(paths) formatter = 'RuboBot::RuboCop::Formatter::OffenseCountFormatter' = { format: formatter, formatters: [[formatter]] } @paths = Array(paths) @runner = ::RuboCop::Runner.new(, ::RuboCop::ConfigStore.new) end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 |
# File 'lib/rubobot/rubocop/offenses.rb', line 29 def ==(other) to_h == other.to_h end |
#next ⇒ Object
19 20 21 22 23 |
# File 'lib/rubobot/rubocop/offenses.rb', line 19 def next Offense.new([offenses.shift].to_h) rescue TypeError raise NoOffensesError end |
#size ⇒ Object
25 26 27 |
# File 'lib/rubobot/rubocop/offenses.rb', line 25 def size offenses.size end |
#to_h ⇒ Object
33 34 35 36 37 |
# File 'lib/rubobot/rubocop/offenses.rb', line 33 def to_h offenses.each_with_object({}) do |(cop, count), memo| memo[cop.name] = count end end |