reek 4.0.0 → 4.0.1

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: d3d1f1d919181f67b1404d126a1dd1e92b6b36e3
4
- data.tar.gz: cd338514426fb1ea540fc73a0192fb7e492edcbc
3
+ metadata.gz: 8d43b7fe788a2ad7e920eb34098cd2ac8eb9d399
4
+ data.tar.gz: fbccb8b4b7020ca6e86a823f8da449560d417dd7
5
5
  SHA512:
6
- metadata.gz: 706c68a4e8ce046d345b4e6f6acdcbe767d47becb217e01b62c10e7029e3490b7e8f2f98c8fadfd52264e68f855da40d1243ed536206ce168fe35ebb4baea9cf
7
- data.tar.gz: a94a1759d26ec2cf3da345116ebb55736eff62963b750f414b3387f189ee4b46f7413b872e9c2ccbe24bdeab9b46370cb7175487dadb92af4155a03cfb6a83d3
6
+ metadata.gz: 1da698aa80dde3b094eb7d1a0d63090438b0fc0f4792f4f460e0949428c9c91397d7caf39ea20773a1cc44541794f66d2d8e57428a9cb0e74a4aead8d17719b5
7
+ data.tar.gz: 9a5a2b29af8b5e69c31f04910a35f8109cda43195bd18a87bb00df6f674266c9f2bab86c348bf0b3fdbab6ee11d16680d412cec46a4c5fb55624306efa257dad
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 4.0.1 (2016-04-10)
4
+
5
+ * (thepry) Fix excluded paths for custom config formats.
6
+
3
7
  ## 4.0.0 (2016-03-21)
4
8
 
5
9
  * (troessner) Fix disabling UnusedPrivateMethod via `exclude` in configuration.
@@ -13,13 +13,14 @@ module Reek
13
13
  # command line.
14
14
  #
15
15
  class Application
16
+ include Input
16
17
  attr_reader :configuration
17
18
 
18
19
  def initialize(argv)
19
20
  @options = configure_options(argv)
20
21
  @status = options.success_exit_code
21
22
  @configuration = configure_app_configuration(options.config_file)
22
- @command = command_class.new(OptionInterpreter.new(options))
23
+ @command = command_class.new(OptionInterpreter.new(options), sources: sources)
23
24
  end
24
25
 
25
26
  def execute
@@ -48,6 +49,10 @@ module Reek
48
49
  def command_class
49
50
  options.generate_todo_list ? Command::TodoListCommand : Command::ReportCommand
50
51
  end
52
+
53
+ def argv
54
+ options.argv
55
+ end
51
56
  end
52
57
  end
53
58
  end
@@ -6,21 +6,18 @@ module Reek
6
6
  # Base class for all commands
7
7
  #
8
8
  class BaseCommand
9
- def initialize(options)
9
+ def initialize(options, sources:)
10
10
  @options = options
11
+ @sources = sources
11
12
  end
12
13
 
13
14
  private
14
15
 
15
- attr_reader :options
16
+ attr_reader :options, :sources
16
17
 
17
18
  def smell_names
18
19
  @smell_names ||= options.smells_to_detect
19
20
  end
20
-
21
- def sources
22
- @sources ||= options.sources
23
- end
24
21
  end
25
22
  end
26
23
  end
@@ -34,7 +34,7 @@ module Reek
34
34
 
35
35
  # :reek:UtilityFunction
36
36
  def working_directory_as_source
37
- Source::SourceLocator.new(['.']).sources
37
+ Source::SourceLocator.new(['.'], configuration: configuration).sources
38
38
  end
39
39
 
40
40
  def sources_from_argv
@@ -9,7 +9,6 @@ module Reek
9
9
  # Interprets the options set from the command line
10
10
  #
11
11
  class OptionInterpreter
12
- include Input
13
12
  extend Forwardable
14
13
  def_delegators :options, :smells_to_detect, :success_exit_code, :failure_exit_code
15
14
 
data/lib/reek/version.rb CHANGED
@@ -7,6 +7,6 @@ module Reek
7
7
  # @public
8
8
  module Version
9
9
  # @public
10
- STRING = '4.0.0'.freeze
10
+ STRING = '4.0.1'.freeze
11
11
  end
12
12
  end
@@ -11,7 +11,7 @@ RSpec.describe Reek::CLI::Command::ReportCommand do
11
11
  let(:reporter) { double 'reporter' }
12
12
  let(:app) { double 'app' }
13
13
 
14
- let(:command) { described_class.new option_interpreter }
14
+ let(:command) { described_class.new(option_interpreter, sources: []) }
15
15
 
16
16
  before do
17
17
  allow(option_interpreter).to receive(:reporter).and_return reporter
@@ -20,7 +20,6 @@ RSpec.describe Reek::CLI::Command::ReportCommand do
20
20
 
21
21
  context 'when no smells are found' do
22
22
  before do
23
- allow(option_interpreter).to receive(:sources).and_return []
24
23
  allow(reporter).to receive(:smells?).and_return false
25
24
  end
26
25
 
@@ -32,7 +31,6 @@ RSpec.describe Reek::CLI::Command::ReportCommand do
32
31
 
33
32
  context 'when smells are found' do
34
33
  before do
35
- allow(option_interpreter).to receive(:sources).and_return []
36
34
  allow(reporter).to receive(:smells?).and_return true
37
35
  end
38
36
 
@@ -7,7 +7,7 @@ RSpec.describe Reek::CLI::Command::TodoListCommand do
7
7
  describe '#execute' do
8
8
  let(:option_interpreter) { FactoryGirl.build(:options_interpreter_with_empty_sources) }
9
9
  let(:app) { double 'app' }
10
- let(:command) { described_class.new option_interpreter }
10
+ let(:command) { described_class.new(option_interpreter, sources: []) }
11
11
 
12
12
  before do
13
13
  $stdout = StringIO.new
@@ -52,7 +52,7 @@ RSpec.describe Reek::CLI::Command::TodoListCommand do
52
52
  end
53
53
 
54
54
  describe 'groups_for' do
55
- let(:command) { described_class.new({}) }
55
+ let(:command) { described_class.new({}, sources: []) }
56
56
 
57
57
  it 'returns a proper hash representation of the smells found' do
58
58
  smells = [FactoryGirl.build(:smell_warning)]
@@ -7,10 +7,22 @@ RSpec.describe Reek::CLI::Input do
7
7
  include Reek::CLI::Input
8
8
 
9
9
  def argv; end
10
+
11
+ def configuration; end
12
+ end
13
+
14
+ let(:path_excluded_in_configuration) do
15
+ SAMPLES_PATH.join('source_with_exclude_paths/ignore_me/uncommunicative_method_name.rb')
10
16
  end
11
17
 
18
+ let(:configuration) { test_configuration_for(SAMPLES_PATH.join('configuration/with_excluded_paths.reek')) }
19
+
12
20
  subject { DummyClass.new }
13
21
 
22
+ before do
23
+ allow(subject).to receive(:configuration).and_return(configuration)
24
+ end
25
+
14
26
  describe '#sources' do
15
27
  context 'when no source files given' do
16
28
  before do
@@ -38,6 +50,10 @@ RSpec.describe Reek::CLI::Input do
38
50
  it 'should use working directory as source' do
39
51
  expect(subject.sources).to_not be_empty
40
52
  end
53
+
54
+ it 'should use configuration for excluded paths' do
55
+ expect(subject.sources).to_not include(path_excluded_in_configuration)
56
+ end
41
57
  end
42
58
  end
43
59
 
data/spec/spec_helper.rb CHANGED
@@ -5,17 +5,13 @@ require_relative '../lib/reek/ast/ast_node_class_map'
5
5
  require_relative '../lib/reek/configuration/app_configuration'
6
6
 
7
7
  Reek::CLI::Silencer.silently do
8
- require 'factory_girl'
9
8
  begin
10
9
  require 'pry-byebug'
11
10
  rescue LoadError # rubocop:disable Lint/HandleExceptions
12
11
  end
13
12
  end
14
- if Gem.loaded_specs['factory_girl'].version > Gem::Version.create('4.5.0')
15
- raise 'Remove the above silencer as well as this check now that ' \
16
- '`factory_girl` gem is updated to version greater than 4.5.0!'
17
- end
18
13
 
14
+ require 'factory_girl'
19
15
  FactoryGirl.find_definitions
20
16
 
21
17
  SAMPLES_PATH = Pathname.new("#{__dir__}/samples").relative_path_from(Pathname.pwd)
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: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Rutherford
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-03-21 00:00:00.000000000 Z
14
+ date: 2016-04-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: codeclimate-engine-rb