lib/quality/runner.rb in quality-17.2.0 vs lib/quality/runner.rb in quality-18.0.0
- old
+ new
@@ -1,16 +1,19 @@
require 'active_support/inflector'
require 'forwardable'
+require_relative 'which'
require_relative 'tools/cane'
require_relative 'tools/flay'
require_relative 'tools/flog'
require_relative 'tools/reek'
require_relative 'tools/rubocop'
require_relative 'tools/bigfiles'
+require_relative 'tools/pep8'
require_relative 'tools/punchlist'
require_relative 'tools/brakeman'
require_relative 'tools/rails_best_practices'
+require_relative 'tools/eslint'
module Quality
# Knows how to run different quality tools based on a configuration
# already determined.
class Runner
@@ -18,37 +21,42 @@
include Tools::Flay
include Tools::Flog
include Tools::Reek
include Tools::Rubocop
include Tools::Bigfiles
+ include Tools::Pep8
include Tools::Punchlist
include Tools::Brakeman
include Tools::RailsBestPractices
+ include Tools::Eslint
extend ::Forwardable
def initialize(config,
gem_spec: Gem::Specification,
quality_checker_class: Quality::QualityChecker,
count_io: IO,
count_file: File,
- globber: Dir)
+ globber: Dir,
+ which: Which.new)
@config = config
@gem_spec = gem_spec
@quality_checker_class = quality_checker_class
@count_io = count_io
@count_file = count_file
@globber = globber
+ @which = which
end
def run_quality
tools.each { |tool| run_quality_with_tool(tool) }
end
def run_quality_with_tool(tool)
- installed = @gem_spec.find_all_by_name(tool).any?
suppressed = @config.skip_tools.include? tool
+ installed = @gem_spec.find_all_by_name(tool).any? ||
+ !@which.which(tool).nil?
if installed && !suppressed
method("quality_#{tool}".to_sym).call
elsif !installed
puts "#{tool} not installed"
@@ -95,10 +103,11 @@
@config.verbose)
quality_checker.execute(&count_violations_on_line)
end
def_delegators :@config, :ruby_files, :ruby_files_glob,
+ :python_files, :python_files_glob,
:source_files_glob, :punchlist_regexp,
:source_files_exclude_glob, :exclude_files,
- :source_and_doc_files_glob
+ :source_and_doc_files_glob, :js_files_arr
end
end