reek 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/.rubocop.yml +66 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +25 -0
- data/CHANGELOG +6 -0
- data/CONTRIBUTING.md +106 -0
- data/Gemfile +14 -0
- data/README.md +16 -21
- data/bin/reek +2 -2
- data/config/cucumber.yml +3 -0
- data/config/defaults.reek +1 -1
- data/features/command_line_interface/smell_selection.feature +4 -8
- data/features/command_line_interface/smells_count.feature +25 -32
- data/features/command_line_interface/stdin.feature +2 -2
- data/features/configuration_files/masking_smells.feature +30 -41
- data/features/configuration_files/overrides_defaults.feature +5 -3
- data/features/configuration_loading.feature +26 -23
- data/features/programmatic_access.feature +24 -0
- data/features/rake_task/rake_task.feature +25 -22
- data/features/reports/json.feature +24 -26
- data/features/reports/reports.feature +77 -103
- data/features/reports/yaml.feature +26 -20
- data/features/ruby_api/api.feature +4 -3
- data/features/samples.feature +21 -20
- data/features/step_definitions/.rubocop.yml +5 -0
- data/features/step_definitions/reek_steps.rb +16 -28
- data/features/step_definitions/sample_file_steps.rb +158 -0
- data/features/support/env.rb +16 -27
- data/lib/reek.rb +3 -3
- data/lib/reek/cli/application.rb +4 -4
- data/lib/reek/cli/command.rb +1 -1
- data/lib/reek/cli/input.rb +2 -4
- data/lib/reek/cli/option_interpreter.rb +9 -9
- data/lib/reek/cli/options.rb +5 -4
- data/lib/reek/cli/reek_command.rb +3 -3
- data/lib/reek/cli/report/formatter.rb +2 -2
- data/lib/reek/cli/report/heading_formatter.rb +1 -1
- data/lib/reek/cli/report/location_formatter.rb +1 -1
- data/lib/reek/cli/report/report.rb +4 -4
- data/lib/reek/configuration/app_configuration.rb +1 -1
- data/lib/reek/configuration/configuration_file_finder.rb +17 -32
- data/lib/reek/core/code_context.rb +1 -1
- data/lib/reek/core/method_context.rb +6 -2
- data/lib/reek/core/module_context.rb +2 -2
- data/lib/reek/core/singleton_method_context.rb +1 -1
- data/lib/reek/core/smell_repository.rb +3 -2
- data/lib/reek/core/tree_walker.rb +4 -4
- data/lib/reek/examiner.rb +4 -4
- data/lib/reek/smells/attribute.rb +3 -3
- data/lib/reek/smells/boolean_parameter.rb +2 -2
- data/lib/reek/smells/class_variable.rb +2 -2
- data/lib/reek/smells/control_parameter.rb +2 -2
- data/lib/reek/smells/data_clump.rb +2 -3
- data/lib/reek/smells/duplicate_method_call.rb +2 -2
- data/lib/reek/smells/feature_envy.rb +6 -2
- data/lib/reek/smells/irresponsible_module.rb +3 -3
- data/lib/reek/smells/long_parameter_list.rb +3 -3
- data/lib/reek/smells/long_yield_list.rb +2 -2
- data/lib/reek/smells/module_initialize.rb +2 -2
- data/lib/reek/smells/nested_iterators.rb +2 -2
- data/lib/reek/smells/nil_check.rb +2 -2
- data/lib/reek/smells/prima_donna_method.rb +2 -2
- data/lib/reek/smells/repeated_conditional.rb +3 -2
- data/lib/reek/smells/smell_detector.rb +2 -2
- data/lib/reek/smells/too_many_instance_variables.rb +2 -2
- data/lib/reek/smells/too_many_methods.rb +2 -2
- data/lib/reek/smells/too_many_statements.rb +2 -2
- data/lib/reek/smells/uncommunicative_method_name.rb +2 -2
- data/lib/reek/smells/uncommunicative_module_name.rb +2 -2
- data/lib/reek/smells/uncommunicative_parameter_name.rb +2 -2
- data/lib/reek/smells/uncommunicative_variable_name.rb +2 -2
- data/lib/reek/smells/unused_parameters.rb +2 -2
- data/lib/reek/smells/utility_function.rb +8 -9
- data/lib/reek/source/ast_node.rb +1 -1
- data/lib/reek/source/ast_node_class_map.rb +6 -6
- data/lib/reek/source/sexp_extensions.rb +11 -2
- data/lib/reek/source/source_code.rb +10 -2
- data/lib/reek/source/source_locator.rb +1 -3
- data/lib/reek/source/source_repository.rb +3 -4
- data/lib/reek/source/tree_dresser.rb +2 -2
- data/lib/reek/spec.rb +3 -3
- data/lib/reek/spec/should_reek.rb +3 -3
- data/lib/reek/spec/should_reek_of.rb +1 -1
- data/lib/reek/spec/should_reek_only_of.rb +3 -3
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +18 -24
- data/spec/factories/factories.rb +1 -1
- data/spec/gem/updates_spec.rb +1 -1
- data/spec/gem/yard_spec.rb +1 -1
- data/spec/quality/reek_source_spec.rb +1 -1
- data/spec/reek/cli/html_report_spec.rb +6 -9
- data/spec/reek/cli/json_report_spec.rb +6 -6
- data/spec/reek/cli/option_interperter_spec.rb +5 -5
- data/spec/reek/cli/text_report_spec.rb +16 -19
- data/spec/reek/cli/yaml_report_spec.rb +7 -10
- data/spec/reek/configuration/app_configuration_spec.rb +23 -25
- data/spec/reek/configuration/configuration_file_finder_spec.rb +46 -21
- data/spec/reek/core/code_context_spec.rb +17 -19
- data/spec/reek/core/method_context_spec.rb +15 -14
- data/spec/reek/core/module_context_spec.rb +5 -7
- data/spec/reek/core/object_refs_spec.rb +4 -6
- data/spec/reek/core/singleton_method_context_spec.rb +5 -7
- data/spec/reek/core/smell_configuration_spec.rb +5 -7
- data/spec/reek/core/smell_repository_spec.rb +8 -8
- data/spec/reek/core/stop_context_spec.rb +4 -7
- data/spec/reek/core/tree_walker_spec.rb +5 -7
- data/spec/reek/core/warning_collector_spec.rb +5 -7
- data/spec/reek/examiner_spec.rb +10 -12
- data/spec/reek/smell_warning_spec.rb +7 -9
- data/spec/reek/smells/attribute_spec.rb +6 -6
- data/spec/reek/smells/boolean_parameter_spec.rb +4 -4
- data/spec/reek/smells/class_variable_spec.rb +6 -6
- data/spec/reek/smells/control_parameter_spec.rb +4 -4
- data/spec/reek/smells/data_clump_spec.rb +4 -4
- data/spec/reek/smells/duplicate_method_call_spec.rb +6 -6
- data/spec/reek/smells/feature_envy_spec.rb +9 -10
- data/spec/reek/smells/irresponsible_module_spec.rb +7 -7
- data/spec/reek/smells/long_parameter_list_spec.rb +5 -5
- data/spec/reek/smells/long_yield_list_spec.rb +5 -5
- data/spec/reek/smells/module_initialize_spec.rb +3 -3
- data/spec/reek/smells/nested_iterators_spec.rb +4 -4
- data/spec/reek/smells/nil_check_spec.rb +5 -5
- data/spec/reek/smells/prima_donna_method_spec.rb +7 -4
- data/spec/reek/smells/repeated_conditional_spec.rb +12 -11
- data/spec/reek/smells/smell_detector_shared.rb +4 -5
- data/spec/reek/smells/too_many_instance_variables_spec.rb +4 -4
- data/spec/reek/smells/too_many_methods_spec.rb +11 -7
- data/spec/reek/smells/too_many_statements_spec.rb +6 -5
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +4 -4
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +7 -7
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +5 -5
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +9 -6
- data/spec/reek/smells/unused_parameters_spec.rb +3 -3
- data/spec/reek/smells/utility_function_spec.rb +41 -37
- data/spec/reek/source/code_comment_spec.rb +19 -17
- data/spec/reek/source/object_source_spec.rb +1 -3
- data/spec/reek/source/reference_collector_spec.rb +5 -6
- data/spec/reek/source/sexp_extensions_spec.rb +9 -11
- data/spec/reek/source/sexp_formatter_spec.rb +7 -8
- data/spec/reek/source/sexp_node_spec.rb +3 -5
- data/spec/reek/source/source_code_spec.rb +9 -9
- data/spec/reek/source/tree_dresser_spec.rb +4 -6
- data/spec/reek/spec/should_reek_of_spec.rb +11 -10
- data/spec/reek/spec/should_reek_only_of_spec.rb +4 -7
- data/spec/reek/spec/should_reek_spec.rb +4 -7
- data/spec/samples/{overrides/masked/lower.reek → masked_by_dotfile/.reek} +3 -1
- data/spec/spec_helper.rb +4 -4
- data/tasks/develop.rake +1 -1
- data/tasks/reek.rake +1 -1
- metadata +72 -86
- data/features/support/hooks.rb +0 -15
- data/lib/reek/source.rb +0 -16
- data/lib/reek/source/core_extras.rb +0 -46
- data/lib/reek/source/source_file.rb +0 -16
- data/spec/samples/config/allow_duplication.reek +0 -3
- data/spec/samples/config/deeper_nested_iterators.reek +0 -3
- data/spec/samples/configuration_loading/minimal_dirty.rb +0 -4
- data/spec/samples/configuration_loading/reek-test-run-disable_smells.reek +0 -7
- data/spec/samples/configuration_loading/reek-test-run-enable_smells.reek +0 -7
- data/spec/samples/corrupt_config_file/corrupt.reek +0 -1
- data/spec/samples/corrupt_config_file/dirty.rb +0 -8
- data/spec/samples/demo/demo.rb +0 -8
- data/spec/samples/empty_config_file/dirty.rb +0 -8
- data/spec/samples/empty_config_file/empty.reek +0 -0
- data/spec/samples/inline_config/dirty.rb +0 -16
- data/spec/samples/inline_config/masked.reek +0 -7
- data/spec/samples/mask_some/dirty.rb +0 -8
- data/spec/samples/mask_some/some.reek +0 -8
- data/spec/samples/masked/dirty.rb +0 -8
- data/spec/samples/masked/masked.reek +0 -5
- data/spec/samples/minimal_smelly_and_masked/config.reek +0 -7
- data/spec/samples/minimal_smelly_and_masked/minimal_dirty.rb +0 -4
- data/spec/samples/mixed_results/clean_one.rb +0 -7
- data/spec/samples/mixed_results/clean_three.rb +0 -7
- data/spec/samples/mixed_results/clean_two.rb +0 -7
- data/spec/samples/mixed_results/dirty_one.rb +0 -8
- data/spec/samples/mixed_results/dirty_two.rb +0 -8
- data/spec/samples/not_quite_masked/dirty.rb +0 -8
- data/spec/samples/not_quite_masked/masked.reek +0 -5
- data/spec/samples/not_quite_masked/smelly.rb +0 -3
- data/spec/samples/one_smelly_file/dirty.rb +0 -3
- data/spec/samples/overrides/masked/dirty.rb +0 -8
- data/spec/samples/overrides/upper.reek +0 -5
- data/spec/samples/overrides_defaults/camel_case.rb +0 -14
- data/spec/samples/overrides_defaults/config.reek +0 -6
- data/spec/samples/standard_smelly/dirty.rb +0 -8
- data/spec/samples/standard_smelly/minimal_dirty.rb +0 -4
- data/spec/samples/three_smelly_files/dirty_one.rb +0 -3
- data/spec/samples/three_smelly_files/dirty_three.rb +0 -5
- data/spec/samples/three_smelly_files/dirty_two.rb +0 -4
data/features/support/hooks.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
After('@remove-disable-smell-config-from-current-dir') do
|
2
|
-
Pathname.pwd.join('reek-test-run-disable_smells.reek').delete
|
3
|
-
end
|
4
|
-
|
5
|
-
After('@remove-disable-smell-config-from-parent-dir') do
|
6
|
-
Pathname.pwd.parent.join('reek-test-run-disable_smells.reek').delete
|
7
|
-
end
|
8
|
-
|
9
|
-
After('@remove-disable-smell-config-from-home-dir') do
|
10
|
-
Pathname.new(Dir.home).join('reek-test-run-disable_smells.reek').delete
|
11
|
-
end
|
12
|
-
|
13
|
-
After('@remove-enable-smell-config-from-current-dir') do
|
14
|
-
Pathname.pwd.join('reek-test-run-enable_smells.reek').delete
|
15
|
-
end
|
data/lib/reek/source.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'reek/source/code_comment'
|
2
|
-
require 'reek/source/core_extras'
|
3
|
-
require 'reek/source/sexp_formatter'
|
4
|
-
require 'reek/source/source_code'
|
5
|
-
require 'reek/source/source_file'
|
6
|
-
require 'reek/source/source_locator'
|
7
|
-
require 'reek/source/tree_dresser'
|
8
|
-
|
9
|
-
module Reek
|
10
|
-
#
|
11
|
-
# This module contains a set of classes for interacting with Ruby
|
12
|
-
# source code and abstract syntax trees.
|
13
|
-
#
|
14
|
-
module Source # :nodoc: all
|
15
|
-
end
|
16
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'reek/source/source_code'
|
2
|
-
|
3
|
-
#
|
4
|
-
# Extensions to +File+ needed by Reek.
|
5
|
-
#
|
6
|
-
class File
|
7
|
-
#
|
8
|
-
# Creates a new +Source+ that assumes this File contains Ruby source
|
9
|
-
# code and prepares it to be examined for code smells.
|
10
|
-
#
|
11
|
-
# @return [Reek::Source::SourceFile]
|
12
|
-
#
|
13
|
-
def to_reek_source
|
14
|
-
Reek::Source::SourceFile.new(path)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
# Extensions to +IO+ needed by Reek.
|
20
|
-
#
|
21
|
-
class IO
|
22
|
-
#
|
23
|
-
# Creates a new +Source+ that assumes this IO stream contains Ruby source
|
24
|
-
# code and prepares it to be examined for code smells.
|
25
|
-
#
|
26
|
-
# @return [Reek::Source::SourceCode]
|
27
|
-
#
|
28
|
-
def to_reek_source(description = 'io')
|
29
|
-
Reek::Source::SourceCode.new(readlines.join, description)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
#
|
34
|
-
# Extensions to +String+ needed by Reek.
|
35
|
-
#
|
36
|
-
class String
|
37
|
-
#
|
38
|
-
# Creates a new +Source+ that assumes this string contains Ruby source
|
39
|
-
# code and prepares it to be examined for code smells.
|
40
|
-
#
|
41
|
-
# @return [Reek::Source::SourceCode]
|
42
|
-
#
|
43
|
-
def to_reek_source
|
44
|
-
Reek::Source::SourceCode.new(self, 'string')
|
45
|
-
end
|
46
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'reek/source/source_code'
|
2
|
-
|
3
|
-
module Reek
|
4
|
-
module Source
|
5
|
-
#
|
6
|
-
# Represents a file of Ruby source, whose contents will be examined
|
7
|
-
# for code smells.
|
8
|
-
#
|
9
|
-
class SourceFile < SourceCode
|
10
|
-
def initialize(path)
|
11
|
-
@path = path
|
12
|
-
super(IO.readlines(@path).join, @path)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
This is not a config file
|
data/spec/samples/demo/demo.rb
DELETED
File without changes
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# :reek:DuplicateMethodCall: { allow_calls: [ puts ] }
|
2
|
-
# smells of :reek:NestedIterators but ignores them
|
3
|
-
class Dirty
|
4
|
-
def a
|
5
|
-
puts @s.title
|
6
|
-
@s = fred.map {|x| x.each {|key| key += 3}}
|
7
|
-
puts @s.title
|
8
|
-
end
|
9
|
-
|
10
|
-
# :reek:DuplicateMethodCall: { max_calls: 2 }
|
11
|
-
def b
|
12
|
-
puts @s.title
|
13
|
-
@s = fred.map {|x| x.each {|key| key += 3}}
|
14
|
-
puts @s.title
|
15
|
-
end
|
16
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Class containing camelCase variable which would normally smell
|
2
|
-
class CamelCase
|
3
|
-
def initialize
|
4
|
-
# These next two would normally smell if it weren't for overridden config values
|
5
|
-
camelCaseVariable = []
|
6
|
-
anotherOne = 1
|
7
|
-
|
8
|
-
# this next one should still smell
|
9
|
-
x1 = 0
|
10
|
-
|
11
|
-
# this next one should not smell
|
12
|
-
should_not_smell = true
|
13
|
-
end
|
14
|
-
end
|