class Scold::Scolder
Constants
- DEFAULT_CFG_NAME
Public Class Methods
new(args = [])
click to toggle source
# File lib/scold/scolder.rb, line 7 def initialize(args = []) @args = args.dup end
run(args = [])
click to toggle source
# File lib/scold/scolder.rb, line 39 def self.run(args = []) new(args).call end
Public Instance Methods
call()
click to toggle source
# File lib/scold/scolder.rb, line 11 def call err = Exit::FAILURE cfg_hound = File.expand_path("../hound.yml", __FILE__) cfg_current = File.expand_path(DEFAULT_CFG_NAME, Dir.pwd) cfg_scold = File.expand_path("../scold.yml", __FILE__) cfg_strict = unless ENV["SCOLD_NO_STRICT"] File.expand_path(".rubocop_strict.yml", Dir.home) end require "tempfile" cfg = Tempfile.new("rubocop-scold-") begin cfg << "inherit_from:\n" cfg << " - #{cfg_hound}\n" cfg << " - #{cfg_current}\n" if file?(cfg_current) cfg << " - #{cfg_scold}\n" if file?(cfg_scold) cfg << " - #{cfg_strict}\n" if file?(cfg_strict) cfg.close args = %W(--force-exclusion -c #{cfg.path}).concat(@args) require "rubocop" err = RuboCop::CLI.new.run(args) ensure cfg.close! end err end
Private Instance Methods
file?(value)
click to toggle source
# File lib/scold/scolder.rb, line 45 def file?(value) value && File.file?(value) end