Sha256: f1f20c4649689ad0b04314685f92c266575e17d9bd86d10eed184fb819b5fbc6

Contents?: true

Size: 775 Bytes

Versions: 12

Compression:

Stored size: 775 Bytes

Contents

require File.join(File.dirname(File.expand_path(__FILE__)), 'source_code')

module Reek
  module Source

    #
    # Represents a file of Ruby source, whose contents will be examined
    # for code smells.
    #
    class SourceFile < SourceCode

      def initialize(path)
        @path = path
        super(IO.readlines(@path).join, @path)
      end

      def configure(sniffer)
        path = File.expand_path(File.dirname(@path))
        all_config_files(path).each { |cf| ConfigFile.new(cf).configure(sniffer) }
      end

    private

      def all_config_files(path)
        return [] unless File.exist?(path)
        parent = File.dirname(path)
        return [] if path == parent
        all_config_files(parent) + Dir["#{path}/*.reek"]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
reek-1.3.1 lib/reek/source/source_file.rb
reek-1.3 lib/reek/source/source_file.rb
reek-1.2.13 lib/reek/source/source_file.rb
reek-1.2.12 lib/reek/source/source_file.rb
reek-1.2.11 lib/reek/source/source_file.rb
reek-1.2.10 lib/reek/source/source_file.rb
reek-1.2.9 lib/reek/source/source_file.rb
reek-1.2.8 lib/reek/source/source_file.rb
reek-1.2.7.3 lib/reek/source/source_file.rb
reek-1.2.7.2 lib/reek/source/source_file.rb
reek-1.2.7.1 lib/reek/source/source_file.rb
reek-1.2.7 lib/reek/source/source_file.rb