reek 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.rubocop.yml +4 -0
 - data/CHANGELOG +4 -0
 - data/lib/reek/configuration/app_configuration.rb +2 -2
 - data/lib/reek/report/formatter.rb +1 -1
 - data/lib/reek/smells/nested_iterators.rb +1 -1
 - data/lib/reek/source/source_locator.rb +11 -8
 - data/lib/reek/version.rb +1 -1
 - data/spec/reek/source/source_locator_spec.rb +20 -3
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d10cc19d7d47e9a5094aaf117aac55072abe9064
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: db2544839858ea0cad619f8bef26c77e0ebb9745
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0b29e3d3b6fcdcd5399b3d6faa881c88a226626589f5fff426c62e550c836b53b74280117a0dd9e362a9921b5fac4b2b86762714388d5a48ed425b0425c703e5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7bc7a0108f69942487dc213fa76a5f43c09780d8c162151c0a66351aaa5520cafc2c4de5946050034827b3c6dcea5ad7abe728e709c6481efd62c0031df1b732
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/CHANGELOG
    CHANGED
    
    
| 
         @@ -18,7 +18,7 @@ module Reek 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  def self.header(examiner)
         
     | 
| 
       19 
19 
     | 
    
         
             
                    count = examiner.smells_count
         
     | 
| 
       20 
20 
     | 
    
         
             
                    result = Rainbow("#{examiner.description} -- ").cyan +
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
                      Rainbow("#{count} warning").yellow
         
     | 
| 
       22 
22 
     | 
    
         
             
                    result += Rainbow('s').yellow unless count == 1
         
     | 
| 
       23 
23 
     | 
    
         
             
                    result
         
     | 
| 
       24 
24 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -66,7 +66,7 @@ module Reek 
     | 
|
| 
       66 
66 
     | 
    
         
             
                  def find_iters_for_iter_node(exp, depth)
         
     | 
| 
       67 
67 
     | 
    
         
             
                    ignored = ignored_iterator? exp
         
     | 
| 
       68 
68 
     | 
    
         
             
                    result = find_iters(exp.call, depth) +
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 69 
     | 
    
         
            +
                      find_iters(exp.block, depth + (ignored ? 0 : 1))
         
     | 
| 
       70 
70 
     | 
    
         
             
                    result << [exp, depth] unless ignored
         
     | 
| 
       71 
71 
     | 
    
         
             
                    result
         
     | 
| 
       72 
72 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -11,7 +11,9 @@ module Reek 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  #
         
     | 
| 
       12 
12 
     | 
    
         
             
                  # paths - a list of paths as Strings
         
     | 
| 
       13 
13 
     | 
    
         
             
                  def initialize(paths)
         
     | 
| 
       14 
     | 
    
         
            -
                    @ 
     | 
| 
      
 14 
     | 
    
         
            +
                    @pathnames = paths.
         
     | 
| 
      
 15 
     | 
    
         
            +
                      map { |path| Pathname.new(path.chomp('/')) }.
         
     | 
| 
      
 16 
     | 
    
         
            +
                      flat_map { |pathname| current_directory?(pathname) ? pathname.entries : pathname }
         
     | 
| 
       15 
17 
     | 
    
         
             
                  end
         
     | 
| 
       16 
18 
     | 
    
         | 
| 
       17 
19 
     | 
    
         
             
                  # Traverses all paths we initialized the SourceLocator with, finds
         
     | 
| 
         @@ -25,11 +27,9 @@ module Reek 
     | 
|
| 
       25 
27 
     | 
    
         
             
                  private
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
       27 
29 
     | 
    
         
             
                  def source_paths
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                       
     | 
| 
       31 
     | 
    
         
            -
                      Find.find(given_path) do |path|
         
     | 
| 
       32 
     | 
    
         
            -
                        pathname = Pathname.new(path)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    @pathnames.each_with_object([]) do |given_pathname, relevant_paths|
         
     | 
| 
      
 31 
     | 
    
         
            +
                      print_no_such_file_error(given_pathname) && next unless path_exists?(given_pathname)
         
     | 
| 
      
 32 
     | 
    
         
            +
                      given_pathname.find do |pathname|
         
     | 
| 
       33 
33 
     | 
    
         
             
                        if pathname.directory?
         
     | 
| 
       34 
34 
     | 
    
         
             
                          ignore_path?(pathname) ? Find.prune : next
         
     | 
| 
       35 
35 
     | 
    
         
             
                        else
         
     | 
| 
         @@ -37,7 +37,6 @@ module Reek 
     | 
|
| 
       37 
37 
     | 
    
         
             
                        end
         
     | 
| 
       38 
38 
     | 
    
         
             
                      end
         
     | 
| 
       39 
39 
     | 
    
         
             
                    end
         
     | 
| 
       40 
     | 
    
         
            -
                    relevant_paths.flatten.sort
         
     | 
| 
       41 
40 
     | 
    
         
             
                  end
         
     | 
| 
       42 
41 
     | 
    
         | 
| 
       43 
42 
     | 
    
         
             
                  def path_excluded?(pathname)
         
     | 
| 
         @@ -61,7 +60,11 @@ module Reek 
     | 
|
| 
       61 
60 
     | 
    
         
             
                  end
         
     | 
| 
       62 
61 
     | 
    
         | 
| 
       63 
62 
     | 
    
         
             
                  def ruby_file?(pathname)
         
     | 
| 
       64 
     | 
    
         
            -
                    pathname. 
     | 
| 
      
 63 
     | 
    
         
            +
                    pathname.extname == '.rb'
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  def current_directory?(pathname)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    ['.', './'].include? pathname.to_s
         
     | 
| 
       65 
68 
     | 
    
         
             
                  end
         
     | 
| 
       66 
69 
     | 
    
         
             
                end
         
     | 
| 
       67 
70 
     | 
    
         
             
              end
         
     | 
    
        data/lib/reek/version.rb
    CHANGED
    
    
| 
         @@ -16,7 +16,7 @@ RSpec.describe Reek::Source::SourceLocator do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                    sources = described_class.new([path]).sources
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                    expect(sources.map(&:path)).
         
     | 
| 
       19 
     | 
    
         
            -
                      not_to include(files_that_are_expected_to_be_ignored)
         
     | 
| 
      
 19 
     | 
    
         
            +
                      not_to include(*files_that_are_expected_to_be_ignored)
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                    expect(sources.map(&:path)).to eq expected_files
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -37,7 +37,7 @@ RSpec.describe Reek::Source::SourceLocator do 
     | 
|
| 
       37 
37 
     | 
    
         
             
                      sources = described_class.new([path]).sources
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                      expect(sources.map(&:path).sort).
         
     | 
| 
       40 
     | 
    
         
            -
                        not_to include(files_that_are_expected_to_be_ignored)
         
     | 
| 
      
 40 
     | 
    
         
            +
                        not_to include(*files_that_are_expected_to_be_ignored)
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                      expect(sources.map(&:path).sort).to eq [
         
     | 
| 
       43 
43 
     | 
    
         
             
                        'spec/samples/source_with_exclude_paths/nested/uncommunicative_parameter_name.rb'
         
     | 
| 
         @@ -62,10 +62,27 @@ RSpec.describe Reek::Source::SourceLocator do 
     | 
|
| 
       62 
62 
     | 
    
         
             
                    sources = described_class.new([path]).sources
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
                    expect(sources.map(&:path)).
         
     | 
| 
       65 
     | 
    
         
            -
                      not_to include(files_that_are_expected_to_be_ignored)
         
     | 
| 
      
 65 
     | 
    
         
            +
                      not_to include(*files_that_are_expected_to_be_ignored)
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         
             
                    expect(sources.map(&:path)).to eq expected_files
         
     | 
| 
       68 
68 
     | 
    
         
             
                  end
         
     | 
| 
       69 
69 
     | 
    
         
             
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                context 'passing "." or "./" as argument' do
         
     | 
| 
      
 72 
     | 
    
         
            +
                  let(:expected_files) do
         
     | 
| 
      
 73 
     | 
    
         
            +
                    [
         
     | 
| 
      
 74 
     | 
    
         
            +
                      'spec/spec_helper.rb',
         
     | 
| 
      
 75 
     | 
    
         
            +
                      'lib/reek.rb'
         
     | 
| 
      
 76 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                  it 'expands it correctly' do
         
     | 
| 
      
 80 
     | 
    
         
            +
                    sources_for_dot       = described_class.new(['.']).sources
         
     | 
| 
      
 81 
     | 
    
         
            +
                    sources_for_dot_slash = described_class.new(['./']).sources
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                    expect(sources_for_dot.map(&:path)).to include(*expected_files)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    expect(sources_for_dot.map(&:path)).to eq(sources_for_dot_slash.map(&:path))
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
       70 
87 
     | 
    
         
             
              end
         
     | 
| 
       71 
88 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: reek
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kevin Rutherford
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2015-07- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2015-07-04 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: parser
         
     |