reek 4.4.2 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/CHANGELOG.md +16 -0
- data/CONTRIBUTING.md +52 -23
- data/README.md +16 -3
- data/ataru_setup.rb +1 -1
- data/docs/API.md +1 -4
- data/docs/How-reek-works-internally.md +5 -5
- data/docs/Style-Guide.md +7 -0
- data/features/command_line_interface/options.feature +1 -0
- data/features/command_line_interface/show_progress.feature +33 -0
- data/features/configuration_files/masking_smells.feature +0 -1
- data/features/configuration_via_source_comments/erroneous_source_comments.feature +18 -4
- data/features/configuration_via_source_comments/well_formed_source_comments.feature +116 -0
- data/features/step_definitions/sample_file_steps.rb +5 -0
- data/features/todo_list.feature +42 -14
- data/lib/reek.rb +1 -1
- data/lib/reek/cli/application.rb +5 -0
- data/lib/reek/cli/command/report_command.rb +6 -1
- data/lib/reek/cli/command/todo_list_command.rb +1 -2
- data/lib/reek/cli/options.rb +19 -3
- data/lib/reek/code_comment.rb +83 -11
- data/lib/reek/configuration/configuration_validator.rb +2 -2
- data/lib/reek/errors/bad_detector_in_comment_error.rb +35 -0
- data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +34 -0
- data/lib/reek/examiner.rb +36 -14
- data/lib/reek/report.rb +28 -9
- data/lib/reek/report/base_report.rb +77 -0
- data/lib/reek/report/code_climate.rb +4 -0
- data/lib/reek/report/code_climate/code_climate_fingerprint.rb +48 -0
- data/lib/reek/report/code_climate/code_climate_formatter.rb +5 -0
- data/lib/reek/report/code_climate/code_climate_report.rb +19 -0
- data/lib/reek/report/formatter.rb +5 -56
- data/lib/reek/report/{heading_formatter.rb → formatter/heading_formatter.rb} +4 -4
- data/lib/reek/report/formatter/location_formatter.rb +41 -0
- data/lib/reek/report/formatter/progress_formatter.rb +80 -0
- data/lib/reek/report/formatter/simple_warning_formatter.rb +35 -0
- data/lib/reek/report/formatter/wiki_link_warning_formatter.rb +35 -0
- data/lib/reek/report/html_report.rb +21 -0
- data/lib/reek/report/{html_report.html.erb → html_report/html_report.html.erb} +0 -0
- data/lib/reek/report/json_report.rb +18 -0
- data/lib/reek/report/text_report.rb +68 -0
- data/lib/reek/report/xml_report.rb +61 -0
- data/lib/reek/report/yaml_report.rb +18 -0
- data/lib/reek/smell_detectors.rb +30 -0
- data/lib/reek/{smells → smell_detectors}/attribute.rb +3 -3
- data/lib/reek/{smells/smell_detector.rb → smell_detectors/base_detector.rb} +3 -3
- data/lib/reek/{smells → smell_detectors}/boolean_parameter.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/class_variable.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/control_parameter.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/data_clump.rb +3 -3
- data/lib/reek/{smells/smell_repository.rb → smell_detectors/detector_repository.rb} +9 -9
- data/lib/reek/{smells → smell_detectors}/duplicate_method_call.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/feature_envy.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/instance_variable_assumption.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/irresponsible_module.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/long_parameter_list.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/long_yield_list.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/manual_dispatch.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/module_initialize.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/nested_iterators.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/nil_check.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/prima_donna_method.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/repeated_conditional.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/smell_configuration.rb +1 -1
- data/lib/reek/{smells → smell_detectors}/smell_warning.rb +1 -1
- data/lib/reek/{smells → smell_detectors}/subclassed_from_core_class.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/too_many_constants.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/too_many_instance_variables.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/too_many_methods.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/too_many_statements.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/uncommunicative_method_name.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/uncommunicative_module_name.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/uncommunicative_parameter_name.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/uncommunicative_variable_name.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/unused_parameters.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/unused_private_method.rb +3 -3
- data/lib/reek/{smells → smell_detectors}/utility_function.rb +3 -3
- data/lib/reek/spec/should_reek_of.rb +1 -1
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +1 -1
- data/spec/factories/factories.rb +6 -6
- data/spec/reek/cli/command/report_command_spec.rb +3 -1
- data/spec/reek/cli/options_spec.rb +12 -2
- data/spec/reek/code_comment_spec.rb +18 -6
- data/spec/reek/configuration/app_configuration_spec.rb +12 -12
- data/spec/reek/configuration/default_directive_spec.rb +1 -1
- data/spec/reek/configuration/directory_directives_spec.rb +2 -2
- data/spec/reek/examiner_spec.rb +56 -28
- data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +122 -0
- data/spec/reek/report/{code_climate_formatter_spec.rb → code_climate/code_climate_formatter_spec.rb} +6 -2
- data/spec/reek/report/{code_climate_report_spec.rb → code_climate/code_climate_report_spec.rb} +7 -5
- data/spec/reek/report/{location_formatter_spec.rb → formatter/location_formatter_spec.rb} +4 -4
- data/spec/reek/report/formatter/progress_formatter_spec.rb +68 -0
- data/spec/reek/report/html_report_spec.rb +1 -1
- data/spec/reek/report/json_report_spec.rb +2 -2
- data/spec/reek/report/text_report_spec.rb +3 -4
- data/spec/reek/report/xml_report_spec.rb +1 -1
- data/spec/reek/report/yaml_report_spec.rb +2 -2
- data/spec/reek/report_spec.rb +3 -3
- data/spec/reek/{smells → smell_detectors}/attribute_spec.rb +2 -2
- data/spec/reek/{smells/smell_detector_spec.rb → smell_detectors/base_detector_spec.rb} +5 -5
- data/spec/reek/{smells → smell_detectors}/boolean_parameter_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/class_variable_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/control_parameter_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/data_clump_spec.rb +2 -2
- data/spec/reek/smell_detectors/detector_repository_spec.rb +22 -0
- data/spec/reek/{smells → smell_detectors}/duplicate_method_call_spec.rb +6 -6
- data/spec/reek/{smells → smell_detectors}/feature_envy_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/instance_variable_assumption_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/irresponsible_module_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/long_parameter_list_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/long_yield_list_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/manual_dispatch_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/module_initialize_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/nested_iterators_spec.rb +4 -4
- data/spec/reek/{smells → smell_detectors}/nil_check_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/prima_donna_method_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/repeated_conditional_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/smell_configuration_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/smell_warning_spec.rb +3 -3
- data/spec/reek/{smells → smell_detectors}/subclassed_from_core_class_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/too_many_constants_spec.rb +3 -3
- data/spec/reek/{smells → smell_detectors}/too_many_instance_variables_spec.rb +3 -3
- data/spec/reek/{smells → smell_detectors}/too_many_methods_spec.rb +3 -3
- data/spec/reek/{smells → smell_detectors}/too_many_statements_spec.rb +3 -3
- data/spec/reek/{smells → smell_detectors}/uncommunicative_method_name_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/uncommunicative_module_name_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/uncommunicative_parameter_name_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/uncommunicative_variable_name_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/unused_parameters_spec.rb +2 -2
- data/spec/reek/{smells → smell_detectors}/unused_private_method_spec.rb +4 -4
- data/spec/reek/{smells → smell_detectors}/utility_function_spec.rb +3 -3
- data/spec/reek/spec/should_reek_of_spec.rb +3 -3
- data/tasks/configuration.rake +2 -2
- metadata +95 -81
- data/features/smells/subclassed_from_core_class.feature +0 -14
- data/features/smells/too_many_constants.feature +0 -19
- data/lib/reek/errors.rb +0 -32
- data/lib/reek/report/location_formatter.rb +0 -39
- data/lib/reek/report/report.rb +0 -229
- data/lib/reek/smells.rb +0 -30
- data/spec/reek/smells/smell_repository_spec.rb +0 -22
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/too_many_constants'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::ManualDispatch do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
class Alfa
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/module_initialize'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::ModuleInitialize do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
module Alfa
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/nested_iterators'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::NestedIterators do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def alfa(bravo)
|
@@ -225,7 +225,7 @@ RSpec.describe Reek::Smells::NestedIterators do
|
|
225
225
|
|
226
226
|
context 'setting the allowed nesting depth to 3' do
|
227
227
|
let(:config) do
|
228
|
-
{ Reek::
|
228
|
+
{ Reek::SmellDetectors::NestedIterators::MAX_ALLOWED_NESTING_KEY => 3 }
|
229
229
|
end
|
230
230
|
|
231
231
|
it 'does not report nested iterators 3 levels deep' do
|
@@ -261,7 +261,7 @@ RSpec.describe Reek::Smells::NestedIterators do
|
|
261
261
|
|
262
262
|
context 'when ignoring iterators' do
|
263
263
|
let(:config) do
|
264
|
-
{ Reek::
|
264
|
+
{ Reek::SmellDetectors::NestedIterators::IGNORE_ITERATORS_KEY => ['ignore_me'] }
|
265
265
|
end
|
266
266
|
|
267
267
|
it 'does not report when nesting the ignored iterator inside another' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/nil_check'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::NilCheck do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def alfa(bravo)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/prima_donna_method'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::PrimaDonnaMethod do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
class Alfa
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/repeated_conditional'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::RepeatedConditional do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
class Alfa
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/smell_configuration'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::SmellConfiguration do
|
5
5
|
context 'when overriding default configs' do
|
6
6
|
let(:base_config) do
|
7
7
|
{
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/smell_warning'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::SmellWarning do
|
5
5
|
let(:duplication_detector) { build(:smell_detector, smell_type: 'DuplicateMethodCall') }
|
6
6
|
let(:feature_envy_detector) { build(:smell_detector, smell_type: 'FeatureEnvy') }
|
7
7
|
let(:utility_function_detector) { build(:smell_detector, smell_type: 'UtilityFunction') }
|
@@ -101,7 +101,7 @@ RSpec.describe Reek::Smells::SmellWarning do
|
|
101
101
|
let(:context_name) { 'Module::Class#method/block' }
|
102
102
|
let(:lines) { [24, 513] }
|
103
103
|
let(:message) { 'test message' }
|
104
|
-
let(:detector) { Reek::
|
104
|
+
let(:detector) { Reek::SmellDetectors::FeatureEnvy.new }
|
105
105
|
let(:parameters) { { 'one' => 34, 'two' => 'second' } }
|
106
106
|
let(:smell_type) { 'FeatureEnvy' }
|
107
107
|
let(:source) { 'a/ruby/source/file.rb' }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/subclassed_from_core_class'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::SubclassedFromCoreClass do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
class Alfa < Hash
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/too_many_constants'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::TooManyConstants do
|
5
5
|
let(:config) do
|
6
|
-
{ Reek::
|
6
|
+
{ Reek::SmellDetectors::TooManyConstants::MAX_ALLOWED_CONSTANTS_KEY => 2 }
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reports the right values' do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/too_many_instance_variables'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::TooManyInstanceVariables do
|
5
5
|
let(:config) do
|
6
|
-
{ Reek::
|
6
|
+
{ Reek::SmellDetectors::TooManyInstanceVariables::MAX_ALLOWED_IVARS_KEY => 2 }
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reports the right values' do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/too_many_methods'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::TooManyMethods do
|
5
5
|
let(:config) do
|
6
|
-
{ Reek::
|
6
|
+
{ Reek::SmellDetectors::TooManyMethods::MAX_ALLOWED_METHODS_KEY => 3 }
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reports the right values' do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/too_many_statements'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::TooManyStatements do
|
5
5
|
let(:config) do
|
6
|
-
{ Reek::
|
6
|
+
{ Reek::SmellDetectors::TooManyStatements::MAX_ALLOWED_STATEMENTS_KEY => 2 }
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reports the right values' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/uncommunicative_method_name'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UncommunicativeMethodName do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def m; end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/uncommunicative_module_name'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UncommunicativeModuleName do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
class K
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/uncommunicative_parameter_name'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UncommunicativeParameterName do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def alfa(x)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/uncommunicative_variable_name'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UncommunicativeVariableName do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def alfa
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/unused_parameters'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UnusedParameters do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def alfa(bravo)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/unused_private_method'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UnusedPrivateMethod do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
class Alfa
|
@@ -176,7 +176,7 @@ RSpec.describe Reek::Smells::UnusedPrivateMethod do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'excludes them via direct match in the app configuration' do
|
179
|
-
config = { Reek::
|
179
|
+
config = { Reek::SmellDetectors::BaseDetector::EXCLUDE_KEY => ['Alfa#charlie'] }
|
180
180
|
|
181
181
|
expect(source).
|
182
182
|
to reek_of(:UnusedPrivateMethod, name: 'bravo').with_config(config).
|
@@ -184,7 +184,7 @@ RSpec.describe Reek::Smells::UnusedPrivateMethod do
|
|
184
184
|
end
|
185
185
|
|
186
186
|
it 'excludes them via regex in the app configuration' do
|
187
|
-
config = { Reek::
|
187
|
+
config = { Reek::SmellDetectors::BaseDetector::EXCLUDE_KEY => [/charlie/] }
|
188
188
|
|
189
189
|
expect(source).
|
190
190
|
to reek_of(:UnusedPrivateMethod, name: 'bravo').with_config(config).
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
|
-
require_lib 'reek/
|
2
|
+
require_lib 'reek/smell_detectors/utility_function'
|
3
3
|
|
4
|
-
RSpec.describe Reek::
|
4
|
+
RSpec.describe Reek::SmellDetectors::UtilityFunction do
|
5
5
|
it 'reports the right values' do
|
6
6
|
src = <<-EOS
|
7
7
|
def alfa(bravo)
|
@@ -191,7 +191,7 @@ RSpec.describe Reek::Smells::UtilityFunction do
|
|
191
191
|
|
192
192
|
describe 'disabling UtilityFunction via configuration for non-public methods' do
|
193
193
|
let(:config) do
|
194
|
-
{ Reek::
|
194
|
+
{ Reek::SmellDetectors::UtilityFunction::PUBLIC_METHODS_ONLY_KEY => true }
|
195
195
|
end
|
196
196
|
|
197
197
|
context 'public methods' do
|
@@ -13,7 +13,7 @@ RSpec.describe Reek::Spec::ShouldReekOf do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'reports duplicate calls by smell detector class' do
|
16
|
-
expect(ruby).to reek_of(Reek::
|
16
|
+
expect(ruby).to reek_of(Reek::SmellDetectors::DuplicateMethodCall)
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'does not report any feature envy' do
|
@@ -132,8 +132,8 @@ RSpec.describe Reek::Spec::ShouldReekOf do
|
|
132
132
|
|
133
133
|
context 'for a smell that is disabled by default' do
|
134
134
|
before do
|
135
|
-
default_config = Reek::
|
136
|
-
expect(default_config[Reek::
|
135
|
+
default_config = Reek::SmellDetectors::UnusedPrivateMethod.default_config
|
136
|
+
expect(default_config[Reek::SmellDetectors::SmellConfiguration::ENABLED_KEY]).to be_falsy
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'enables the smell detector to match automatically' do
|
data/tasks/configuration.rake
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../lib/reek/
|
1
|
+
require_relative '../lib/reek/smell_detectors/detector_repository'
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
namespace :configuration do
|
5
5
|
desc 'Updates the default configuration file when smell defaults change'
|
6
6
|
task :update_default_configuration do
|
7
7
|
DEFAULT_SMELL_CONFIGURATION = 'defaults.reek'.freeze
|
8
|
-
content = Reek::
|
8
|
+
content = Reek::SmellDetectors::DetectorRepository.smell_types.each_with_object({}) do |klass, hash|
|
9
9
|
hash[klass.smell_type] = klass.default_config
|
10
10
|
end
|
11
11
|
File.open(DEFAULT_SMELL_CONFIGURATION, 'w') { |file| YAML.dump(content, file) }
|
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.
|
4
|
+
version: 4.5.0
|
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-10-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: codeclimate-engine-rb
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.4.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.4.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: parser
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- engine.json
|
145
145
|
- features/command_line_interface/basic_usage.feature
|
146
146
|
- features/command_line_interface/options.feature
|
147
|
+
- features/command_line_interface/show_progress.feature
|
147
148
|
- features/command_line_interface/smell_selection.feature
|
148
149
|
- features/command_line_interface/smells_count.feature
|
149
150
|
- features/command_line_interface/stdin.feature
|
@@ -156,14 +157,13 @@ files:
|
|
156
157
|
- features/configuration_files/unused_private_method.feature
|
157
158
|
- features/configuration_loading.feature
|
158
159
|
- features/configuration_via_source_comments/erroneous_source_comments.feature
|
160
|
+
- features/configuration_via_source_comments/well_formed_source_comments.feature
|
159
161
|
- features/programmatic_access.feature
|
160
162
|
- features/rake_task/rake_task.feature
|
161
163
|
- features/reports/json.feature
|
162
164
|
- features/reports/reports.feature
|
163
165
|
- features/reports/yaml.feature
|
164
166
|
- features/samples.feature
|
165
|
-
- features/smells/subclassed_from_core_class.feature
|
166
|
-
- features/smells/too_many_constants.feature
|
167
167
|
- features/step_definitions/.rubocop.yml
|
168
168
|
- features/step_definitions/reek_steps.rb
|
169
169
|
- features/step_definitions/sample_file_steps.rb
|
@@ -220,51 +220,63 @@ files:
|
|
220
220
|
- lib/reek/context/statement_counter.rb
|
221
221
|
- lib/reek/context/visibility_tracker.rb
|
222
222
|
- lib/reek/context_builder.rb
|
223
|
-
- lib/reek/errors.rb
|
223
|
+
- lib/reek/errors/bad_detector_in_comment_error.rb
|
224
|
+
- lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
|
224
225
|
- lib/reek/examiner.rb
|
225
226
|
- lib/reek/rake/task.rb
|
226
227
|
- lib/reek/report.rb
|
228
|
+
- lib/reek/report/base_report.rb
|
229
|
+
- lib/reek/report/code_climate.rb
|
227
230
|
- lib/reek/report/code_climate/code_climate_configuration.yml
|
231
|
+
- lib/reek/report/code_climate/code_climate_fingerprint.rb
|
228
232
|
- lib/reek/report/code_climate/code_climate_formatter.rb
|
233
|
+
- lib/reek/report/code_climate/code_climate_report.rb
|
229
234
|
- lib/reek/report/formatter.rb
|
230
|
-
- lib/reek/report/heading_formatter.rb
|
231
|
-
- lib/reek/report/
|
232
|
-
- lib/reek/report/
|
233
|
-
- lib/reek/report/
|
234
|
-
- lib/reek/
|
235
|
-
- lib/reek/
|
236
|
-
- lib/reek/
|
237
|
-
- lib/reek/
|
238
|
-
- lib/reek/
|
239
|
-
- lib/reek/
|
240
|
-
- lib/reek/
|
241
|
-
- lib/reek/
|
242
|
-
- lib/reek/
|
243
|
-
- lib/reek/
|
244
|
-
- lib/reek/
|
245
|
-
- lib/reek/
|
246
|
-
- lib/reek/
|
247
|
-
- lib/reek/
|
248
|
-
- lib/reek/
|
249
|
-
- lib/reek/
|
250
|
-
- lib/reek/
|
251
|
-
- lib/reek/
|
252
|
-
- lib/reek/
|
253
|
-
- lib/reek/
|
254
|
-
- lib/reek/
|
255
|
-
- lib/reek/
|
256
|
-
- lib/reek/
|
257
|
-
- lib/reek/
|
258
|
-
- lib/reek/
|
259
|
-
- lib/reek/
|
260
|
-
- lib/reek/
|
261
|
-
- lib/reek/
|
262
|
-
- lib/reek/
|
263
|
-
- lib/reek/
|
264
|
-
- lib/reek/
|
265
|
-
- lib/reek/
|
266
|
-
- lib/reek/
|
267
|
-
- lib/reek/
|
235
|
+
- lib/reek/report/formatter/heading_formatter.rb
|
236
|
+
- lib/reek/report/formatter/location_formatter.rb
|
237
|
+
- lib/reek/report/formatter/progress_formatter.rb
|
238
|
+
- lib/reek/report/formatter/simple_warning_formatter.rb
|
239
|
+
- lib/reek/report/formatter/wiki_link_warning_formatter.rb
|
240
|
+
- lib/reek/report/html_report.rb
|
241
|
+
- lib/reek/report/html_report/html_report.html.erb
|
242
|
+
- lib/reek/report/json_report.rb
|
243
|
+
- lib/reek/report/text_report.rb
|
244
|
+
- lib/reek/report/xml_report.rb
|
245
|
+
- lib/reek/report/yaml_report.rb
|
246
|
+
- lib/reek/smell_detectors.rb
|
247
|
+
- lib/reek/smell_detectors/attribute.rb
|
248
|
+
- lib/reek/smell_detectors/base_detector.rb
|
249
|
+
- lib/reek/smell_detectors/boolean_parameter.rb
|
250
|
+
- lib/reek/smell_detectors/class_variable.rb
|
251
|
+
- lib/reek/smell_detectors/control_parameter.rb
|
252
|
+
- lib/reek/smell_detectors/data_clump.rb
|
253
|
+
- lib/reek/smell_detectors/detector_repository.rb
|
254
|
+
- lib/reek/smell_detectors/duplicate_method_call.rb
|
255
|
+
- lib/reek/smell_detectors/feature_envy.rb
|
256
|
+
- lib/reek/smell_detectors/instance_variable_assumption.rb
|
257
|
+
- lib/reek/smell_detectors/irresponsible_module.rb
|
258
|
+
- lib/reek/smell_detectors/long_parameter_list.rb
|
259
|
+
- lib/reek/smell_detectors/long_yield_list.rb
|
260
|
+
- lib/reek/smell_detectors/manual_dispatch.rb
|
261
|
+
- lib/reek/smell_detectors/module_initialize.rb
|
262
|
+
- lib/reek/smell_detectors/nested_iterators.rb
|
263
|
+
- lib/reek/smell_detectors/nil_check.rb
|
264
|
+
- lib/reek/smell_detectors/prima_donna_method.rb
|
265
|
+
- lib/reek/smell_detectors/repeated_conditional.rb
|
266
|
+
- lib/reek/smell_detectors/smell_configuration.rb
|
267
|
+
- lib/reek/smell_detectors/smell_warning.rb
|
268
|
+
- lib/reek/smell_detectors/subclassed_from_core_class.rb
|
269
|
+
- lib/reek/smell_detectors/too_many_constants.rb
|
270
|
+
- lib/reek/smell_detectors/too_many_instance_variables.rb
|
271
|
+
- lib/reek/smell_detectors/too_many_methods.rb
|
272
|
+
- lib/reek/smell_detectors/too_many_statements.rb
|
273
|
+
- lib/reek/smell_detectors/uncommunicative_method_name.rb
|
274
|
+
- lib/reek/smell_detectors/uncommunicative_module_name.rb
|
275
|
+
- lib/reek/smell_detectors/uncommunicative_parameter_name.rb
|
276
|
+
- lib/reek/smell_detectors/uncommunicative_variable_name.rb
|
277
|
+
- lib/reek/smell_detectors/unused_parameters.rb
|
278
|
+
- lib/reek/smell_detectors/unused_private_method.rb
|
279
|
+
- lib/reek/smell_detectors/utility_function.rb
|
268
280
|
- lib/reek/source/source_code.rb
|
269
281
|
- lib/reek/source/source_locator.rb
|
270
282
|
- lib/reek/spec.rb
|
@@ -332,48 +344,50 @@ files:
|
|
332
344
|
- spec/reek/context_builder_spec.rb
|
333
345
|
- spec/reek/examiner_spec.rb
|
334
346
|
- spec/reek/rake/task_spec.rb
|
335
|
-
- spec/reek/report/
|
336
|
-
- spec/reek/report/
|
347
|
+
- spec/reek/report/code_climate/code_climate_fingerprint_spec.rb
|
348
|
+
- spec/reek/report/code_climate/code_climate_formatter_spec.rb
|
349
|
+
- spec/reek/report/code_climate/code_climate_report_spec.rb
|
350
|
+
- spec/reek/report/formatter/location_formatter_spec.rb
|
351
|
+
- spec/reek/report/formatter/progress_formatter_spec.rb
|
337
352
|
- spec/reek/report/html_report_spec.rb
|
338
353
|
- spec/reek/report/json_report_spec.rb
|
339
|
-
- spec/reek/report/location_formatter_spec.rb
|
340
354
|
- spec/reek/report/text_report_spec.rb
|
341
355
|
- spec/reek/report/xml_report_spec.rb
|
342
356
|
- spec/reek/report/yaml_report_spec.rb
|
343
357
|
- spec/reek/report_spec.rb
|
344
|
-
- spec/reek/
|
345
|
-
- spec/reek/
|
346
|
-
- spec/reek/
|
347
|
-
- spec/reek/
|
348
|
-
- spec/reek/
|
349
|
-
- spec/reek/
|
350
|
-
- spec/reek/
|
351
|
-
- spec/reek/
|
352
|
-
- spec/reek/
|
353
|
-
- spec/reek/
|
354
|
-
- spec/reek/
|
355
|
-
- spec/reek/
|
356
|
-
- spec/reek/
|
357
|
-
- spec/reek/
|
358
|
-
- spec/reek/
|
359
|
-
- spec/reek/
|
360
|
-
- spec/reek/
|
361
|
-
- spec/reek/
|
362
|
-
- spec/reek/
|
363
|
-
- spec/reek/
|
364
|
-
- spec/reek/
|
365
|
-
- spec/reek/
|
366
|
-
- spec/reek/
|
367
|
-
- spec/reek/
|
368
|
-
- spec/reek/
|
369
|
-
- spec/reek/
|
370
|
-
- spec/reek/
|
371
|
-
- spec/reek/
|
372
|
-
- spec/reek/
|
373
|
-
- spec/reek/
|
374
|
-
- spec/reek/
|
375
|
-
- spec/reek/
|
376
|
-
- spec/reek/
|
358
|
+
- spec/reek/smell_detectors/attribute_spec.rb
|
359
|
+
- spec/reek/smell_detectors/base_detector_spec.rb
|
360
|
+
- spec/reek/smell_detectors/boolean_parameter_spec.rb
|
361
|
+
- spec/reek/smell_detectors/class_variable_spec.rb
|
362
|
+
- spec/reek/smell_detectors/control_parameter_spec.rb
|
363
|
+
- spec/reek/smell_detectors/data_clump_spec.rb
|
364
|
+
- spec/reek/smell_detectors/detector_repository_spec.rb
|
365
|
+
- spec/reek/smell_detectors/duplicate_method_call_spec.rb
|
366
|
+
- spec/reek/smell_detectors/feature_envy_spec.rb
|
367
|
+
- spec/reek/smell_detectors/instance_variable_assumption_spec.rb
|
368
|
+
- spec/reek/smell_detectors/irresponsible_module_spec.rb
|
369
|
+
- spec/reek/smell_detectors/long_parameter_list_spec.rb
|
370
|
+
- spec/reek/smell_detectors/long_yield_list_spec.rb
|
371
|
+
- spec/reek/smell_detectors/manual_dispatch_spec.rb
|
372
|
+
- spec/reek/smell_detectors/module_initialize_spec.rb
|
373
|
+
- spec/reek/smell_detectors/nested_iterators_spec.rb
|
374
|
+
- spec/reek/smell_detectors/nil_check_spec.rb
|
375
|
+
- spec/reek/smell_detectors/prima_donna_method_spec.rb
|
376
|
+
- spec/reek/smell_detectors/repeated_conditional_spec.rb
|
377
|
+
- spec/reek/smell_detectors/smell_configuration_spec.rb
|
378
|
+
- spec/reek/smell_detectors/smell_warning_spec.rb
|
379
|
+
- spec/reek/smell_detectors/subclassed_from_core_class_spec.rb
|
380
|
+
- spec/reek/smell_detectors/too_many_constants_spec.rb
|
381
|
+
- spec/reek/smell_detectors/too_many_instance_variables_spec.rb
|
382
|
+
- spec/reek/smell_detectors/too_many_methods_spec.rb
|
383
|
+
- spec/reek/smell_detectors/too_many_statements_spec.rb
|
384
|
+
- spec/reek/smell_detectors/uncommunicative_method_name_spec.rb
|
385
|
+
- spec/reek/smell_detectors/uncommunicative_module_name_spec.rb
|
386
|
+
- spec/reek/smell_detectors/uncommunicative_parameter_name_spec.rb
|
387
|
+
- spec/reek/smell_detectors/uncommunicative_variable_name_spec.rb
|
388
|
+
- spec/reek/smell_detectors/unused_parameters_spec.rb
|
389
|
+
- spec/reek/smell_detectors/unused_private_method_spec.rb
|
390
|
+
- spec/reek/smell_detectors/utility_function_spec.rb
|
377
391
|
- spec/reek/source/source_code_spec.rb
|
378
392
|
- spec/reek/source/source_locator_spec.rb
|
379
393
|
- spec/reek/spec/should_reek_of_spec.rb
|