reek 3.0.4 → 3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/README.md +41 -20
- data/features/configuration_files/directory_specific_directives.feature +280 -0
- data/features/configuration_files/masking_smells.feature +0 -14
- data/features/step_definitions/sample_file_steps.rb +2 -2
- data/lib/reek/ast/sexp_extensions.rb +72 -60
- data/lib/reek/cli/application.rb +2 -5
- data/lib/reek/cli/reek_command.rb +1 -1
- data/lib/reek/configuration/app_configuration.rb +115 -61
- data/lib/reek/configuration/configuration_file_finder.rb +19 -0
- data/lib/reek/context/code_context.rb +102 -29
- data/lib/reek/context/method_context.rb +11 -48
- data/lib/reek/context/module_context.rb +2 -6
- data/lib/reek/context/root_context.rb +7 -14
- data/lib/reek/examiner.rb +15 -10
- data/lib/reek/report/report.rb +5 -4
- data/lib/reek/smells/boolean_parameter.rb +1 -1
- data/lib/reek/smells/duplicate_method_call.rb +1 -5
- data/lib/reek/smells/irresponsible_module.rb +2 -2
- data/lib/reek/smells/smell_repository.rb +30 -16
- data/lib/reek/smells/utility_function.rb +1 -1
- data/lib/reek/source/source_code.rb +10 -6
- data/lib/reek/source/source_locator.rb +27 -26
- data/lib/reek/spec.rb +8 -6
- data/lib/reek/spec/should_reek.rb +6 -2
- data/lib/reek/spec/should_reek_of.rb +5 -2
- data/lib/reek/spec/should_reek_only_of.rb +1 -1
- data/lib/reek/tree_walker.rb +49 -21
- data/lib/reek/version.rb +1 -1
- data/spec/reek/ast/sexp_extensions_spec.rb +4 -12
- data/spec/reek/configuration/app_configuration_spec.rb +80 -52
- data/spec/reek/configuration/configuration_file_finder_spec.rb +27 -15
- data/spec/reek/context/code_context_spec.rb +66 -17
- data/spec/reek/context/method_context_spec.rb +66 -64
- data/spec/reek/context/root_context_spec.rb +3 -1
- data/spec/reek/context/singleton_method_context_spec.rb +1 -2
- data/spec/reek/examiner_spec.rb +5 -8
- data/spec/reek/report/xml_report_spec.rb +3 -2
- data/spec/reek/smells/attribute_spec.rb +12 -17
- data/spec/reek/smells/duplicate_method_call_spec.rb +17 -25
- data/spec/reek/smells/feature_envy_spec.rb +4 -5
- data/spec/reek/smells/irresponsible_module_spec.rb +43 -0
- data/spec/reek/smells/nested_iterators_spec.rb +12 -26
- data/spec/reek/smells/too_many_statements_spec.rb +2 -210
- data/spec/reek/smells/utility_function_spec.rb +49 -5
- data/spec/reek/source/source_locator_spec.rb +39 -43
- data/spec/reek/spec/should_reek_of_spec.rb +3 -2
- data/spec/reek/spec/should_reek_spec.rb +25 -17
- data/spec/reek/tree_walker_spec.rb +214 -23
- data/spec/samples/configuration/full_configuration.reek +9 -0
- data/spec/spec_helper.rb +10 -10
- metadata +4 -3
- data/features/configuration_files/overrides_defaults.feature +0 -15
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
require 'pathname'
|
1
2
|
require_relative '../lib/reek/spec'
|
2
3
|
require_relative '../lib/reek/ast/ast_node_class_map'
|
3
4
|
require_relative '../lib/reek/configuration/app_configuration'
|
5
|
+
require 'ostruct'
|
4
6
|
|
5
7
|
Reek::CLI::Silencer.silently do
|
6
8
|
require 'factory_girl'
|
@@ -16,22 +18,20 @@ end
|
|
16
18
|
|
17
19
|
FactoryGirl.find_definitions
|
18
20
|
|
19
|
-
|
21
|
+
SAMPLES_PATH = Pathname.new("#{__dir__}/samples").relative_path_from(Pathname.pwd)
|
20
22
|
|
21
23
|
# Simple helpers for our specs.
|
22
24
|
module Helpers
|
23
|
-
def
|
24
|
-
if config.is_a?
|
25
|
-
Reek::Configuration::AppConfiguration.
|
25
|
+
def test_configuration_for(config)
|
26
|
+
if config.is_a? Pathname
|
27
|
+
configuration = Reek::Configuration::AppConfiguration.new OpenStruct.new(config_file: config)
|
26
28
|
elsif config.is_a? Hash
|
27
|
-
Reek::Configuration::AppConfiguration.
|
28
|
-
|
29
|
-
end
|
29
|
+
configuration = Reek::Configuration::AppConfiguration.new
|
30
|
+
configuration.instance_variable_set :@default_directive, config
|
30
31
|
else
|
31
|
-
raise "Unknown config given in `
|
32
|
+
raise "Unknown config given in `test_configuration_for`: #{config.inspect}"
|
32
33
|
end
|
33
|
-
|
34
|
-
Reek::Configuration::AppConfiguration.reset
|
34
|
+
configuration
|
35
35
|
end
|
36
36
|
|
37
37
|
# :reek:UncommunicativeMethodName
|
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.
|
4
|
+
version: '3.1'
|
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-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -251,8 +251,8 @@ files:
|
|
251
251
|
- features/command_line_interface/smell_selection.feature
|
252
252
|
- features/command_line_interface/smells_count.feature
|
253
253
|
- features/command_line_interface/stdin.feature
|
254
|
+
- features/configuration_files/directory_specific_directives.feature
|
254
255
|
- features/configuration_files/masking_smells.feature
|
255
|
-
- features/configuration_files/overrides_defaults.feature
|
256
256
|
- features/configuration_loading.feature
|
257
257
|
- features/programmatic_access.feature
|
258
258
|
- features/rake_task/rake_task.feature
|
@@ -406,6 +406,7 @@ files:
|
|
406
406
|
- spec/samples/clean_due_to_masking/dirty_one.rb
|
407
407
|
- spec/samples/clean_due_to_masking/dirty_two.rb
|
408
408
|
- spec/samples/clean_due_to_masking/masked.reek
|
409
|
+
- spec/samples/configuration/full_configuration.reek
|
409
410
|
- spec/samples/configuration/simple_configuration.reek
|
410
411
|
- spec/samples/configuration/with_excluded_paths.reek
|
411
412
|
- spec/samples/exceptions.reek
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Feature: Overriding current rules by specifying new configuration values
|
2
|
-
In order to customize Reek to suit my needs
|
3
|
-
As a developer
|
4
|
-
I want to be able to override the default configuration values
|
5
|
-
|
6
|
-
Scenario: List of configuration values is overridden by a lower configuration file
|
7
|
-
Given a file with smelly variable names called 'camel_case.rb'
|
8
|
-
And a configuration file allowing camel case variables
|
9
|
-
When I run reek camel_case.rb
|
10
|
-
Then the exit status indicates smells
|
11
|
-
And it reports:
|
12
|
-
"""
|
13
|
-
camel_case.rb -- 1 warning:
|
14
|
-
[9]:CamelCase#initialize has the variable name 'x1' (UncommunicativeVariableName)
|
15
|
-
"""
|