reek 4.6.1 → 4.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -2
- data/README.md +3 -2
- data/bin/code_climate_reek +1 -0
- data/bin/reek +1 -0
- data/lib/reek.rb +1 -0
- data/lib/reek/ast/ast_node_class_map.rb +1 -0
- data/lib/reek/ast/builder.rb +16 -0
- data/lib/reek/ast/node.rb +1 -0
- data/lib/reek/ast/object_refs.rb +1 -0
- data/lib/reek/ast/reference_collector.rb +1 -0
- data/lib/reek/ast/sexp_extensions.rb +1 -0
- data/lib/reek/ast/sexp_extensions/arguments.rb +1 -0
- data/lib/reek/ast/sexp_extensions/attribute_assignments.rb +1 -0
- data/lib/reek/ast/sexp_extensions/block.rb +1 -0
- data/lib/reek/ast/sexp_extensions/case.rb +1 -0
- data/lib/reek/ast/sexp_extensions/constant.rb +1 -0
- data/lib/reek/ast/sexp_extensions/if.rb +1 -0
- data/lib/reek/ast/sexp_extensions/lambda.rb +1 -0
- data/lib/reek/ast/sexp_extensions/literal.rb +1 -0
- data/lib/reek/ast/sexp_extensions/logical_operators.rb +1 -0
- data/lib/reek/ast/sexp_extensions/methods.rb +1 -0
- data/lib/reek/ast/sexp_extensions/module.rb +1 -0
- data/lib/reek/ast/sexp_extensions/nested_assignables.rb +1 -0
- data/lib/reek/ast/sexp_extensions/self.rb +1 -0
- data/lib/reek/ast/sexp_extensions/send.rb +1 -0
- data/lib/reek/ast/sexp_extensions/super.rb +1 -0
- data/lib/reek/ast/sexp_extensions/symbols.rb +1 -0
- data/lib/reek/ast/sexp_extensions/variables.rb +1 -0
- data/lib/reek/ast/sexp_extensions/when.rb +1 -0
- data/lib/reek/ast/sexp_extensions/yield.rb +1 -0
- data/lib/reek/cli/application.rb +1 -0
- data/lib/reek/cli/command/base_command.rb +1 -0
- data/lib/reek/cli/command/report_command.rb +1 -0
- data/lib/reek/cli/command/todo_list_command.rb +1 -0
- data/lib/reek/cli/options.rb +1 -0
- data/lib/reek/cli/silencer.rb +1 -0
- data/lib/reek/cli/status.rb +1 -0
- data/lib/reek/configuration/app_configuration.rb +1 -0
- data/lib/reek/configuration/configuration_file_finder.rb +1 -0
- data/lib/reek/configuration/configuration_validator.rb +1 -0
- data/lib/reek/configuration/default_directive.rb +1 -0
- data/lib/reek/configuration/directory_directives.rb +1 -0
- data/lib/reek/configuration/excluded_paths.rb +1 -0
- data/lib/reek/context/attribute_context.rb +1 -0
- data/lib/reek/context/class_context.rb +1 -0
- data/lib/reek/context/code_context.rb +2 -1
- data/lib/reek/context/ghost_context.rb +1 -0
- data/lib/reek/context/method_context.rb +5 -4
- data/lib/reek/context/module_context.rb +1 -0
- data/lib/reek/context/root_context.rb +1 -0
- data/lib/reek/context/send_context.rb +1 -0
- data/lib/reek/context/singleton_attribute_context.rb +1 -0
- data/lib/reek/context/singleton_method_context.rb +1 -0
- data/lib/reek/context/statement_counter.rb +1 -0
- data/lib/reek/context/visibility_tracker.rb +1 -0
- data/lib/reek/context_builder.rb +1 -0
- data/lib/reek/detector_repository.rb +1 -0
- data/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb +1 -0
- data/lib/reek/errors/bad_detector_in_comment_error.rb +1 -0
- data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +1 -0
- data/lib/reek/errors/incomprehensible_source_error.rb +1 -0
- data/lib/reek/errors/parse_error.rb +1 -0
- data/lib/reek/examiner.rb +1 -0
- data/lib/reek/logging_error_handler.rb +1 -0
- data/lib/reek/report.rb +1 -0
- data/lib/reek/report/base_report.rb +1 -0
- data/lib/reek/report/code_climate.rb +1 -0
- data/lib/reek/report/code_climate/code_climate_configuration.rb +1 -0
- data/lib/reek/report/code_climate/code_climate_fingerprint.rb +1 -0
- data/lib/reek/report/code_climate/code_climate_formatter.rb +1 -0
- data/lib/reek/report/code_climate/code_climate_report.rb +1 -0
- data/lib/reek/report/formatter.rb +1 -0
- data/lib/reek/report/formatter/heading_formatter.rb +1 -0
- data/lib/reek/report/formatter/location_formatter.rb +1 -0
- data/lib/reek/report/formatter/progress_formatter.rb +1 -0
- data/lib/reek/report/formatter/wiki_link_warning_formatter.rb +1 -0
- data/lib/reek/report/html_report.rb +1 -0
- data/lib/reek/report/json_report.rb +1 -0
- data/lib/reek/report/text_report.rb +1 -0
- data/lib/reek/report/xml_report.rb +1 -0
- data/lib/reek/report/yaml_report.rb +1 -0
- data/lib/reek/smell_configuration.rb +1 -0
- data/lib/reek/smell_detectors.rb +1 -0
- data/lib/reek/smell_detectors/attribute.rb +1 -0
- data/lib/reek/smell_detectors/base_detector.rb +1 -0
- data/lib/reek/smell_detectors/boolean_parameter.rb +1 -0
- data/lib/reek/smell_detectors/class_variable.rb +1 -0
- data/lib/reek/smell_detectors/control_parameter.rb +1 -0
- data/lib/reek/smell_detectors/data_clump.rb +1 -0
- data/lib/reek/smell_detectors/duplicate_method_call.rb +1 -0
- data/lib/reek/smell_detectors/feature_envy.rb +1 -0
- data/lib/reek/smell_detectors/instance_variable_assumption.rb +1 -0
- data/lib/reek/smell_detectors/irresponsible_module.rb +1 -0
- data/lib/reek/smell_detectors/long_parameter_list.rb +1 -0
- data/lib/reek/smell_detectors/long_yield_list.rb +1 -0
- data/lib/reek/smell_detectors/manual_dispatch.rb +1 -0
- data/lib/reek/smell_detectors/module_initialize.rb +1 -0
- data/lib/reek/smell_detectors/nested_iterators.rb +1 -0
- data/lib/reek/smell_detectors/nil_check.rb +1 -0
- data/lib/reek/smell_detectors/prima_donna_method.rb +1 -0
- data/lib/reek/smell_detectors/repeated_conditional.rb +1 -0
- data/lib/reek/smell_detectors/subclassed_from_core_class.rb +1 -0
- data/lib/reek/smell_detectors/too_many_constants.rb +1 -0
- data/lib/reek/smell_detectors/too_many_instance_variables.rb +1 -0
- data/lib/reek/smell_detectors/too_many_methods.rb +1 -0
- data/lib/reek/smell_detectors/too_many_statements.rb +1 -0
- data/lib/reek/smell_detectors/uncommunicative_method_name.rb +1 -0
- data/lib/reek/smell_detectors/uncommunicative_module_name.rb +1 -0
- data/lib/reek/smell_detectors/uncommunicative_parameter_name.rb +1 -0
- data/lib/reek/smell_detectors/uncommunicative_variable_name.rb +1 -0
- data/lib/reek/smell_detectors/unused_parameters.rb +1 -0
- data/lib/reek/smell_detectors/unused_private_method.rb +3 -2
- data/lib/reek/smell_detectors/utility_function.rb +1 -0
- data/lib/reek/smell_warning.rb +1 -0
- data/lib/reek/source/source_code.rb +17 -3
- data/lib/reek/source/source_locator.rb +1 -0
- data/lib/reek/spec.rb +1 -0
- data/lib/reek/spec/should_reek.rb +1 -0
- data/lib/reek/spec/should_reek_of.rb +1 -0
- data/lib/reek/spec/should_reek_only_of.rb +1 -0
- data/lib/reek/spec/smell_matcher.rb +2 -1
- data/lib/reek/tree_dresser.rb +1 -0
- data/lib/reek/version.rb +2 -1
- data/reek.gemspec +2 -1
- data/spec/reek/ast/sexp_extensions_spec.rb +1 -0
- data/spec/reek/context/statement_counter_spec.rb +1 -0
- data/spec/reek/examiner_spec.rb +1 -0
- data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +2 -0
- data/spec/reek/report/code_climate/code_climate_report_spec.rb +22 -22
- data/spec/reek/report/yaml_report_spec.rb +32 -32
- data/spec/reek/source/source_code_spec.rb +8 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 621c25e4d095d1164a97aea57967dcf79f1961ec
|
4
|
+
data.tar.gz: 4e9dbb2eee9bec1ac8616811b1895631206cd394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5c4bf0e5c8f2b344b5bec3c386599e1a2d2eadc6e70c484146d771190fcc6fba24986a7747654962caaac5f27c625a49d2f11a5f9f0c8f375b34b309945178b
|
7
|
+
data.tar.gz: a98dab6abcd0ffdc95695ba0883ca078ae9fa3b50d0493bf1d89f3677947d7056d5a3e7529eb9611ad5a50d1ab1efb682f2611247cd0d7225e3d4fcc12396ccb
|
data/.rubocop.yml
CHANGED
@@ -8,6 +8,10 @@ AllCops:
|
|
8
8
|
- 'vendor/**/*'
|
9
9
|
TargetRubyVersion: 2.1
|
10
10
|
|
11
|
+
# Assume the programmer knows how bracketed block syntax works
|
12
|
+
Lint/AmbiguousBlockAssociation:
|
13
|
+
Enabled: false
|
14
|
+
|
11
15
|
Lint/HandleExceptions:
|
12
16
|
Exclude:
|
13
17
|
- 'spec/reek/configuration/configuration_file_finder_spec.rb'
|
@@ -106,6 +110,10 @@ Style/FrozenStringLiteralComment:
|
|
106
110
|
- 'lib/**/*'
|
107
111
|
EnforcedStyle: always
|
108
112
|
|
113
|
+
# Use active_support's strip_heredoc to indent heredocs
|
114
|
+
Style/IndentHeredoc:
|
115
|
+
EnforcedStyle: active_support
|
116
|
+
|
109
117
|
# Allow multiline block chains
|
110
118
|
Style/MultilineBlockChain:
|
111
119
|
Enabled: false
|
@@ -126,6 +134,14 @@ Style/MultilineOperationIndentation:
|
|
126
134
|
Style/ParallelAssignment:
|
127
135
|
Enabled: false
|
128
136
|
|
137
|
+
Style/PercentLiteralDelimiters:
|
138
|
+
PreferredDelimiters:
|
139
|
+
default: ()
|
140
|
+
'%W': ()
|
141
|
+
'%I': ()
|
142
|
+
'%w': ()
|
143
|
+
'%i': ()
|
144
|
+
|
129
145
|
# Allow Perl-style references to regex matches
|
130
146
|
Style/PerlBackrefs:
|
131
147
|
Enabled: false
|
@@ -134,6 +150,10 @@ Style/PerlBackrefs:
|
|
134
150
|
Style/SingleLineMethods:
|
135
151
|
Enabled: false
|
136
152
|
|
153
|
+
# Prefer symbols to look like symbols
|
154
|
+
Style/SymbolArray:
|
155
|
+
EnforcedStyle: brackets
|
156
|
+
|
137
157
|
# Allow small arrays of words with quotes
|
138
158
|
Style/WordArray:
|
139
159
|
MinSize: 4
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -100,6 +100,7 @@ Reek is officially running on the following MRI rubies:
|
|
100
100
|
- 2.1
|
101
101
|
- 2.2
|
102
102
|
- 2.3
|
103
|
+
- 2.4
|
103
104
|
|
104
105
|
Other rubies like Rubinius or JRuby are not officially supported but should work as well.
|
105
106
|
|
@@ -475,7 +476,7 @@ Or just run the whole test suite:
|
|
475
476
|
bundle exec rake
|
476
477
|
```
|
477
478
|
|
478
|
-
This will run the RSpec
|
479
|
+
This will run the tests (RSpec and Cucumber), RuboCop and Reek itself.
|
479
480
|
|
480
481
|
You can also run:
|
481
482
|
|
@@ -484,7 +485,7 @@ bundle exec rake ci
|
|
484
485
|
```
|
485
486
|
|
486
487
|
This will run everything the default task runs and also
|
487
|
-
|
488
|
+
[Ataru](https://github.com/CodePadawans/ataru). This is the task that we run on
|
488
489
|
Travis as well and that determines if your pull request is green or red.
|
489
490
|
|
490
491
|
Another useful Rake task is the `console` task. This will throw you right into an environment where you can play around with Reeks modules and classes:
|
data/bin/code_climate_reek
CHANGED
data/bin/reek
CHANGED
data/lib/reek.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Reek
|
4
|
+
module AST
|
5
|
+
#
|
6
|
+
# An AST Builder for ruby parser.
|
7
|
+
#
|
8
|
+
class Builder < ::Parser::Builders::Default
|
9
|
+
# This is a work around for parsing ruby code that has a string with invliad sequence as UTF-8.
|
10
|
+
# See. https://github.com/whitequark/parser/issues/283
|
11
|
+
def string_value(token)
|
12
|
+
value(token)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/reek/ast/node.rb
CHANGED
data/lib/reek/ast/object_refs.rb
CHANGED
data/lib/reek/cli/application.rb
CHANGED
data/lib/reek/cli/options.rb
CHANGED
data/lib/reek/cli/silencer.rb
CHANGED
data/lib/reek/cli/status.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative '../code_comment'
|
3
4
|
require_relative '../ast/object_refs'
|
4
5
|
require_relative 'statement_counter'
|
@@ -19,7 +20,7 @@ module Reek
|
|
19
20
|
include Enumerable
|
20
21
|
extend Forwardable
|
21
22
|
delegate each_node: :exp
|
22
|
-
delegate
|
23
|
+
delegate [:name, :type] => :exp
|
23
24
|
|
24
25
|
attr_reader :children, :parent, :exp, :statement_counter
|
25
26
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative 'code_context'
|
3
4
|
|
4
5
|
module Reek
|
@@ -40,10 +41,10 @@ module Reek
|
|
40
41
|
|
41
42
|
# :reek:FeatureEnvy
|
42
43
|
def unused_params
|
43
|
-
exp.arguments.
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
exp.arguments.reject do |param|
|
45
|
+
param.anonymous_splat? ||
|
46
|
+
param.marked_unused? ||
|
47
|
+
uses_param?(param.plain_name)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|