Sha256: 5936daf4d1a37745fe14caf5f6aafd5aeebec0d49394bdca8bebae7163a2c3e4

Contents?: true

Size: 898 Bytes

Versions: 2

Compression:

Stored size: 898 Bytes

Contents

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

module Reek
  module Core

    #
    # Configures all available smell detectors and applies them to a source.
    #
    class Sniffer

      def initialize(src, config_files = [], smell_repository=Core::SmellRepository.new(src.desc))
        @smell_repository = smell_repository
        config_files.each{ |cf| Reek::Source::ConfigFile.new(cf).configure(self) }
        @source = src
        src.configure(self)
      end

      def configure(klass, config)
        @smell_repository.configure klass, config
      end

      def report_on(listener)
        CodeParser.new(self).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.3.8 lib/reek/core/sniffer.rb
reek-1.3.7 lib/reek/core/sniffer.rb