reek 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d5b829b54c2856a722ff2906a4d038f4ad3601f
4
- data.tar.gz: 7ad7e5f417d336194b59f1b85b3a518d6b3c9f8c
3
+ metadata.gz: 71abe096497ff72ac2b0ff61c0264cde02d49ff3
4
+ data.tar.gz: 03e5768e1b53aef97a23e47d985daceb3f7316dd
5
5
  SHA512:
6
- metadata.gz: 78e6b08e5ddf25dd0489860320ecc7b8b6ff6e89333ba2051523f37ac7a6318ba1c8c13449cd7978b47118068f9ca773b72223b935393ac9a2a4e3604acfc43d
7
- data.tar.gz: 9aa379ef6f5d621c8916e6c70acff7ad90ffec332458650e9474364b285eb6bd2379385a79d57ce8f59338c4cf91ea0636857e465bf50dc012afcefbc70cb313
6
+ metadata.gz: 9e8b1c75ccd4d2982825ee6f066a834dc602b8d370179740d2a79645bd5ae1c3974ffb466560dc0e4962393f203efb7e8cb603afb22ebd37913d11eb91348c44
7
+ data.tar.gz: c12a018c2777291fdcaaf93d3220b8d3abf193542cbe13763017c982473afa1e22767c3595cca3efe8e64c170954165b4a616412daff0822e1a053e0e8ed6fd5
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 3.0.2
2
+
3
+ * (troessner) Only use ruby source files.
4
+
1
5
  == 3.0.1
2
6
 
3
7
  * (troessner) Fix reek descending into hidden directories
@@ -31,16 +31,16 @@ module Reek
31
31
  Find.find(given_path) do |path|
32
32
  pathname = Pathname.new(path)
33
33
  if pathname.directory?
34
- exclude_path?(pathname) || hidden_directory?(pathname) ? Find.prune : next
34
+ ignore_path?(pathname) ? Find.prune : next
35
35
  else
36
- relevant_paths << pathname
36
+ relevant_paths << pathname if ruby_file?(pathname)
37
37
  end
38
38
  end
39
39
  end
40
40
  relevant_paths.flatten.sort
41
41
  end
42
42
 
43
- def exclude_path?(pathname)
43
+ def path_excluded?(pathname)
44
44
  Configuration::AppConfiguration.exclude_paths.include? pathname.to_s
45
45
  end
46
46
 
@@ -55,6 +55,14 @@ module Reek
55
55
  def hidden_directory?(pathname)
56
56
  pathname.basename.to_s.start_with? '.'
57
57
  end
58
+
59
+ def ignore_path?(pathname)
60
+ path_excluded?(pathname) || hidden_directory?(pathname)
61
+ end
62
+
63
+ def ruby_file?(pathname)
64
+ pathname.to_s.end_with?('.rb')
65
+ end
58
66
  end
59
67
  end
60
68
  end
data/lib/reek/version.rb CHANGED
@@ -3,6 +3,6 @@ module Reek
3
3
  # This module holds the Reek version informations
4
4
  #
5
5
  module Version
6
- STRING = '3.0.1'
6
+ STRING = '3.0.2'
7
7
  end
8
8
  end
@@ -45,5 +45,27 @@ RSpec.describe Reek::Source::SourceLocator do
45
45
  end
46
46
  end
47
47
  end
48
+
49
+ context 'non-ruby files' do
50
+ let(:path) { 'spec/samples/source_with_non_ruby_files' }
51
+ let(:expected_files) do
52
+ ['spec/samples/source_with_non_ruby_files/uncommunicative_parameter_name.rb']
53
+ end
54
+ let(:files_that_are_expected_to_be_ignored) do
55
+ [
56
+ 'spec/samples/source_with_non_ruby_files/gibberish',
57
+ 'spec/samples/source_with_non_ruby_files/python_source.py'
58
+ ]
59
+ end
60
+
61
+ it 'does only use ruby source files' do
62
+ sources = described_class.new([path]).sources
63
+
64
+ expect(sources.map(&:path)).
65
+ not_to include(files_that_are_expected_to_be_ignored)
66
+
67
+ expect(sources.map(&:path)).to eq expected_files
68
+ end
69
+ end
48
70
  end
49
71
  end
@@ -0,0 +1 @@
1
+ adfasfsadfasdfsafsad
@@ -0,0 +1 @@
1
+ print("Hello, World!")
@@ -0,0 +1,6 @@
1
+ # Klass comment
2
+ class Klass
3
+ def method(a)
4
+ a + @x
5
+ end
6
+ 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.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Rutherford
@@ -419,6 +419,9 @@ files:
419
419
  - spec/samples/source_with_exclude_paths/nested/uncommunicative_parameter_name.rb
420
420
  - spec/samples/source_with_hidden_directories/.hidden/uncommunicative_method_name.rb
421
421
  - spec/samples/source_with_hidden_directories/uncommunicative_parameter_name.rb
422
+ - spec/samples/source_with_non_ruby_files/gibberish
423
+ - spec/samples/source_with_non_ruby_files/python_source.py
424
+ - spec/samples/source_with_non_ruby_files/uncommunicative_parameter_name.rb
422
425
  - spec/samples/three_clean_files/clean_one.rb
423
426
  - spec/samples/three_clean_files/clean_three.rb
424
427
  - spec/samples/three_clean_files/clean_two.rb