class RubyCritic::Cli::Options::File
def base_branch
def base_branch return options.dig('mode_ci', 'branch') || 'master' if options.dig('mode_ci', 'enabled').to_s == 'true' options['branch'] end
def deduplicate_symlinks
def deduplicate_symlinks value_for(options['deduplicate_symlinks']) end
def feature_branch
def feature_branch SourceControlSystem::Git.current_branch if base_branch end
def formats
def formats formats = options['formats'] || [] formats.select do |format| %w[html json console lint].include?(format) end end
def initialize(filename = './.rubycritic.yml')
def initialize(filename = './.rubycritic.yml') @filename = filename @options = {} end
def minimum_score
def minimum_score options['minimum_score'] end
def mode
def mode if options.dig('mode_ci', 'enabled').to_s == 'true' :ci elsif base_branch :compare_branches end end
def no_browser
def no_browser value_for(options['no_browser']) end
def parse
def parse @options = YAML.load_file(filename) if ::File.file?(filename) end
def paths
def paths options['paths'] end
def root
def root options['path'] end
def suppress_ratings
def suppress_ratings value_for(options['suppress_ratings']) end
def threshold_score
def threshold_score options['threshold_score'] end
def to_h
def to_h { mode: mode, root: root, formats: formats, deduplicate_symlinks: deduplicate_symlinks, paths: paths, suppress_ratings: suppress_ratings, minimum_score: minimum_score, no_browser: no_browser, base_branch: base_branch, feature_branch: feature_branch, threshold_score: threshold_score } end
def value_for(value)
def value_for(value) value = value.to_s value == 'true' unless value.empty? end