reek 4.0.0 → 4.0.1
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/CHANGELOG.md +4 -0
- data/lib/reek/cli/application.rb +6 -1
- data/lib/reek/cli/command/base_command.rb +3 -6
- data/lib/reek/cli/input.rb +1 -1
- data/lib/reek/cli/option_interpreter.rb +0 -1
- data/lib/reek/version.rb +1 -1
- data/spec/reek/cli/command/report_command_spec.rb +1 -3
- data/spec/reek/cli/command/todo_list_command_spec.rb +2 -2
- data/spec/reek/cli/input_spec.rb +16 -0
- data/spec/spec_helper.rb +1 -5
- 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: 8d43b7fe788a2ad7e920eb34098cd2ac8eb9d399
|
4
|
+
data.tar.gz: fbccb8b4b7020ca6e86a823f8da449560d417dd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da698aa80dde3b094eb7d1a0d63090438b0fc0f4792f4f460e0949428c9c91397d7caf39ea20773a1cc44541794f66d2d8e57428a9cb0e74a4aead8d17719b5
|
7
|
+
data.tar.gz: 9a5a2b29af8b5e69c31f04910a35f8109cda43195bd18a87bb00df6f674266c9f2bab86c348bf0b3fdbab6ee11d16680d412cec46a4c5fb55624306efa257dad
|
data/CHANGELOG.md
CHANGED
data/lib/reek/cli/application.rb
CHANGED
@@ -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
|
data/lib/reek/cli/input.rb
CHANGED
data/lib/reek/version.rb
CHANGED
@@ -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
|
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
|
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)]
|
data/spec/reek/cli/input_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|