Class: Quality::Tools::RailsBestPractices

Inherits:
Tool
  • Object
show all
Defined in:
lib/quality/tools/rails_best_practices.rb

Overview

Adds ‘rubocop’ tool support to quality gem

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tool

#initialize

Constructor Details

This class inherits a constructor from Quality::Tools::Tool

Class Method Details

.count_rails_best_practices_violations(line) ⇒ Object

See Rubocop.included



15
16
17
18
19
20
21
# File 'lib/quality/tools/rails_best_practices.rb', line 15

def self.count_rails_best_practices_violations(line)
  if line =~ /.*:[0-9]* - /
    1
  else
    0
  end
end

Instance Method Details

#quality_rails_best_practicesObject



7
8
9
10
11
12
# File 'lib/quality/tools/rails_best_practices.rb', line 7

def quality_rails_best_practices
  ratchet_quality_cmd('rails_best_practices',
                      gives_error_code_on_violations: true) do |line|
    self.class.count_rails_best_practices_violations(line)
  end
end