Sha256: 4855094525ecbf1131b50e64f124ae8736d31d77e14eeb8eeeaf87597f99cb84

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

require 'reek/core/code_parser'
require 'reek/core/smell_repository'
require 'reek/source/config_file'

module Reek
  module Core
    #
    # Configures all available smell detectors and applies them to a source.
    #
    class Sniffer
      def initialize(src,
                     extra_config_files = [],
                     smell_repository = Core::SmellRepository.new(src.desc))
        @smell_repository = smell_repository
        @source = src

        config_files = extra_config_files + @source.relevant_config_files
        config_files.each { |cf| Reek::Source::ConfigFile.new(cf).configure(@smell_repository) }
      end

      def report_on(listener)
        CodeParser.new(@smell_repository).process(@source.syntax_tree)
        @smell_repository.report_on(listener)
      end

      def examine(scope, node_type)
        @smell_repository.examine scope, node_type
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-1.5.1 lib/reek/core/sniffer.rb
reek-1.5.0 lib/reek/core/sniffer.rb