Sha256: b595f916e391dcfa302c98c95273afe857ca9957b667cad53a40e72de402773a

Contents?: true

Size: 933 Bytes

Versions: 3

Compression:

Stored size: 933 Bytes

Contents

module Preek
  require 'reek'
  require 'thor'
  require 'preek/version'
  require 'preek/smell_collector'
  require 'preek/smell_reporter'
  require 'preek/smell_warning'
  # whoop whoop
  class Preek < Thor
    include Thor::Actions

    desc 'version', 'Shows version'
    def version(*)
      say VERSION
    end

    desc 'FILE', 'Pretty format Reek output'
    def parse(args)
      files, @not_files = args.partition { |file| File.exists? file }
      report_smells_for files unless files.empty?
      report_not_files
    end

  private
    def report_smells_for files
      sources = Reek::Source::SourceLocator.new(files).all_sources
      smelly_files = SmellCollector.new(sources).smelly_files
      @reporter = SmellReporter.new(smelly_files)
      @reporter.print_smells
    end

    def report_not_files
      say_status :error, "No such file(s) - #{@not_files*", "}.", :red unless @not_files.empty?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
preek-0.1.2 lib/preek.rb
preek-0.1.1 lib/preek.rb
preek-0.1.0 lib/preek.rb