reek 5.0.2 → 5.1.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 +9 -70
- data/.rubocop_todo.yml +63 -0
- data/.simplecov +4 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -17
- data/README.md +21 -29
- data/Rakefile +2 -2
- data/docs/templates/default/docstring/setup.rb +3 -0
- data/features/command_line_interface/options.feature +5 -3
- data/features/configuration_files/schema_validation.feature +3 -3
- data/features/configuration_files/show_configuration_file.feature +44 -0
- data/features/rake_task/rake_task.feature +1 -1
- data/features/reports/json.feature +3 -3
- data/features/reports/reports.feature +4 -4
- data/features/reports/yaml.feature +3 -3
- data/features/rspec_matcher.feature +1 -0
- data/features/step_definitions/sample_file_steps.rb +6 -8
- data/features/todo_list.feature +39 -26
- data/lib/reek.rb +7 -0
- data/lib/reek/ast/node.rb +4 -0
- data/lib/reek/ast/sexp_extensions/if.rb +20 -0
- data/lib/reek/ast/sexp_extensions/methods.rb +1 -0
- data/lib/reek/cli/application.rb +25 -0
- data/lib/reek/cli/command/todo_list_command.rb +17 -7
- data/lib/reek/cli/options.rb +21 -14
- data/lib/reek/code_comment.rb +2 -0
- data/lib/reek/configuration/app_configuration.rb +0 -3
- data/lib/reek/configuration/configuration_converter.rb +4 -4
- data/lib/reek/configuration/directory_directives.rb +1 -0
- data/lib/reek/configuration/schema_validator.rb +1 -0
- data/lib/reek/context/method_context.rb +1 -0
- data/lib/reek/context/module_context.rb +5 -4
- data/lib/reek/context/visibility_tracker.rb +7 -4
- data/lib/reek/context_builder.rb +1 -0
- data/lib/reek/detector_repository.rb +1 -0
- data/lib/reek/errors/incomprehensible_source_error.rb +2 -2
- data/lib/reek/errors/syntax_error.rb +4 -0
- data/lib/reek/examiner.rb +1 -0
- data/lib/reek/report/text_report.rb +1 -0
- data/lib/reek/smell_detectors/control_parameter.rb +13 -107
- data/lib/reek/smell_detectors/control_parameter_helpers/call_in_condition_finder.rb +91 -0
- data/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb +38 -0
- data/lib/reek/smell_detectors/control_parameter_helpers/control_parameter_finder.rb +94 -0
- data/lib/reek/smell_detectors/duplicate_method_call.rb +1 -0
- data/lib/reek/smell_detectors/feature_envy.rb +2 -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/manual_dispatch.rb +1 -0
- data/lib/reek/smell_detectors/missing_safe_method.rb +1 -0
- data/lib/reek/smell_detectors/nested_iterators.rb +1 -0
- data/lib/reek/smell_detectors/repeated_conditional.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_variable_name.rb +2 -0
- data/lib/reek/smell_detectors/unused_parameters.rb +1 -0
- data/lib/reek/source/source_locator.rb +1 -0
- data/lib/reek/spec/should_reek_of.rb +2 -2
- data/lib/reek/spec/should_reek_only_of.rb +1 -0
- data/lib/reek/spec/smell_matcher.rb +1 -0
- data/lib/reek/tree_dresser.rb +1 -0
- data/lib/reek/version.rb +1 -1
- data/samples/smelly_source/ruby.rb +368 -0
- data/spec/factories/factories.rb +10 -9
- data/spec/performance/reek/smell_detectors/runtime_speed_spec.rb +17 -0
- data/spec/quality/documentation_spec.rb +40 -0
- data/spec/reek/ast/sexp_extensions_spec.rb +20 -20
- data/spec/reek/cli/application_spec.rb +29 -0
- data/spec/reek/cli/command/todo_list_command_spec.rb +64 -46
- data/spec/reek/configuration/app_configuration_spec.rb +8 -8
- data/spec/reek/configuration/configuration_file_finder_spec.rb +3 -3
- data/spec/reek/configuration/schema_validator_spec.rb +10 -10
- data/spec/reek/detector_repository_spec.rb +2 -2
- data/spec/reek/smell_detectors/control_parameter_spec.rb +17 -0
- data/spec/reek/source/source_locator_spec.rb +0 -2
- data/spec/spec_helper.rb +2 -0
- data/tasks/configuration.rake +2 -1
- data/tasks/test.rake +4 -0
- metadata +11 -5
- data/ataru_setup.rb +0 -13
- data/tasks/ataru.rake +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e1bd0b5a333788b75250144a86c3a1a47a915bb
|
4
|
+
data.tar.gz: b9077da5e1add357ca2411a983cccaef9f754ab5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7c6ea853eabe8c9d2b090bd12c679bf5a95723b9009d48b35e641c106126697e3ad53ed4121b7540ee5d9bf8fe6e95c269bb90f7b16cfb25ea049953f9b2e26
|
7
|
+
data.tar.gz: 2b2cc32734fa88f97792cae488fae2e210981920b53626b3041f3e88846e856cf54e8ad26e8d430992cbb4f3b0fdc6be0f4653cc51dc2528655efda4b2cd7db2
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
1
3
|
require:
|
2
4
|
- rubocop-rspec
|
3
5
|
|
@@ -45,37 +47,11 @@ Lint/InterpolationCheck:
|
|
45
47
|
Lint/BooleanSymbol:
|
46
48
|
Enabled: false
|
47
49
|
|
48
|
-
Lint/HandleExceptions:
|
49
|
-
Exclude:
|
50
|
-
- 'spec/reek/configuration/configuration_file_finder_spec.rb'
|
51
|
-
|
52
50
|
# Spec blocks can be any size
|
53
51
|
Metrics/BlockLength:
|
54
52
|
Exclude:
|
55
53
|
- 'spec/**/*'
|
56
54
|
|
57
|
-
# FIXME: Make the class shorter
|
58
|
-
Metrics/ClassLength:
|
59
|
-
Exclude:
|
60
|
-
- lib/reek/context_builder.rb
|
61
|
-
- lib/reek/cli/options.rb
|
62
|
-
|
63
|
-
Style/SafeNavigation:
|
64
|
-
Exclude:
|
65
|
-
- lib/reek/ast/node.rb
|
66
|
-
- lib/reek/ast/sexp_extensions/module.rb
|
67
|
-
|
68
|
-
# FIXME: Lower the method length by fixing the biggest offenders
|
69
|
-
Metrics/MethodLength:
|
70
|
-
Max: 15
|
71
|
-
Exclude:
|
72
|
-
- 'lib/reek/cli/options.rb'
|
73
|
-
|
74
|
-
Metrics/AbcSize:
|
75
|
-
Exclude:
|
76
|
-
- 'lib/reek/cli/options.rb'
|
77
|
-
- 'lib/reek/configuration/configuration_converter.rb'
|
78
|
-
|
79
55
|
# Be rather lenient with line length
|
80
56
|
Metrics/LineLength:
|
81
57
|
Max: 120
|
@@ -84,56 +60,21 @@ Metrics/LineLength:
|
|
84
60
|
Metrics/ParameterLists:
|
85
61
|
CountKeywordArgs: false
|
86
62
|
|
87
|
-
Naming/AccessorMethodName:
|
88
|
-
Exclude:
|
89
|
-
- 'lib/reek/context/visibility_tracker.rb'
|
90
|
-
|
91
63
|
# EOS is a fine name to use in our specs
|
92
64
|
Naming/HeredocDelimiterNaming:
|
93
65
|
Exclude:
|
94
66
|
- 'spec/**/*'
|
95
67
|
|
96
|
-
#
|
97
|
-
RSpec/AnyInstance:
|
98
|
-
Exclude:
|
99
|
-
- 'spec/reek/cli/application_spec.rb'
|
100
|
-
|
101
|
-
# This file does not test a class
|
68
|
+
# These files do not test classes or modules
|
102
69
|
RSpec/DescribeClass:
|
103
70
|
Exclude:
|
104
|
-
- 'spec/quality
|
71
|
+
- 'spec/quality/*_spec.rb'
|
72
|
+
- 'spec/performance/reek/smell_detectors/runtime_speed_spec.rb'
|
105
73
|
|
106
74
|
# Our examples are large because we have source literals in them
|
107
75
|
RSpec/ExampleLength:
|
108
76
|
Enabled: false
|
109
77
|
|
110
|
-
# FIXME: Split up files to avoid offenses
|
111
|
-
RSpec/MultipleDescribes:
|
112
|
-
Exclude:
|
113
|
-
- 'spec/reek/ast/sexp_extensions_spec.rb'
|
114
|
-
- 'spec/reek/code_comment_spec.rb'
|
115
|
-
- 'spec/reek/report/location_formatter_spec.rb'
|
116
|
-
- 'spec/reek/report/progress_formatter_spec.rb'
|
117
|
-
|
118
|
-
# FIXME: Update specs to avoid offenses
|
119
|
-
RSpec/MultipleExpectations:
|
120
|
-
Exclude:
|
121
|
-
- 'spec/reek/cli/application_spec.rb'
|
122
|
-
- 'spec/reek/code_comment_spec.rb'
|
123
|
-
- 'spec/reek/configuration/app_configuration_spec.rb'
|
124
|
-
- 'spec/reek/context/module_context_spec.rb'
|
125
|
-
- 'spec/reek/context_builder_spec.rb'
|
126
|
-
- 'spec/reek/examiner_spec.rb'
|
127
|
-
- 'spec/reek/spec/should_reek_of_spec.rb'
|
128
|
-
|
129
|
-
# FIXME: Update specs to avoid offenses
|
130
|
-
RSpec/NestedGroups:
|
131
|
-
Exclude:
|
132
|
-
- 'spec/reek/report/code_climate/code_climate_fingerprint_spec.rb'
|
133
|
-
- 'spec/reek/cli/application_spec.rb'
|
134
|
-
- 'spec/reek/configuration/schema_validator_spec.rb'
|
135
|
-
- 'spec/reek/configuration/configuration_file_finder_spec.rb'
|
136
|
-
|
137
78
|
# rubocop-rspec expects a CodeClimate namespace to go with the code_climate directory.
|
138
79
|
RSpec/FilePath:
|
139
80
|
Exclude:
|
@@ -146,12 +87,6 @@ RSpec/FilePath:
|
|
146
87
|
Style/AndOr:
|
147
88
|
EnforcedStyle: conditionals
|
148
89
|
|
149
|
-
Style/Documentation:
|
150
|
-
Exclude:
|
151
|
-
- 'lib/reek/ast/sexp_extensions/send.rb'
|
152
|
-
- 'lib/reek/ast/sexp_extensions/super.rb'
|
153
|
-
- 'lib/reek/ast/sexp_extensions/variables.rb'
|
154
|
-
|
155
90
|
# Require comment for files in lib and bin
|
156
91
|
Style/FrozenStringLiteralComment:
|
157
92
|
Include:
|
@@ -190,3 +125,7 @@ Style/SymbolArray:
|
|
190
125
|
# Allow small arrays of words with quotes
|
191
126
|
Style/WordArray:
|
192
127
|
MinSize: 4
|
128
|
+
|
129
|
+
Metrics/ClassLength:
|
130
|
+
Exclude:
|
131
|
+
- 'lib/reek/cli/options.rb'
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2018-08-17 12:44:20 +0200 using RuboCop version 0.58.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 3
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 21
|
12
|
+
|
13
|
+
# Offense count: 2
|
14
|
+
# Configuration parameters: CountComments.
|
15
|
+
Metrics/ClassLength:
|
16
|
+
Max: 178
|
17
|
+
|
18
|
+
# Offense count: 12
|
19
|
+
# Configuration parameters: CountComments.
|
20
|
+
Metrics/MethodLength:
|
21
|
+
Max: 16
|
22
|
+
|
23
|
+
# Offense count: 2
|
24
|
+
RSpec/AnyInstance:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/reek/cli/application_spec.rb'
|
27
|
+
|
28
|
+
# Offense count: 1
|
29
|
+
# Configuration parameters: CustomIncludeMethods.
|
30
|
+
RSpec/EmptyExampleGroup:
|
31
|
+
Exclude:
|
32
|
+
- 'spec/factories/factories.rb'
|
33
|
+
|
34
|
+
# Offense count: 1
|
35
|
+
RSpec/MissingExampleGroupArgument:
|
36
|
+
Exclude:
|
37
|
+
- 'spec/factories/factories.rb'
|
38
|
+
|
39
|
+
# Offense count: 4
|
40
|
+
RSpec/MultipleDescribes:
|
41
|
+
Exclude:
|
42
|
+
- 'spec/reek/ast/sexp_extensions_spec.rb'
|
43
|
+
- 'spec/reek/code_comment_spec.rb'
|
44
|
+
- 'spec/reek/report/location_formatter_spec.rb'
|
45
|
+
- 'spec/reek/report/progress_formatter_spec.rb'
|
46
|
+
|
47
|
+
# Offense count: 32
|
48
|
+
# Configuration parameters: AggregateFailuresByDefault.
|
49
|
+
RSpec/MultipleExpectations:
|
50
|
+
Max: 5
|
51
|
+
|
52
|
+
# Offense count: 23
|
53
|
+
RSpec/NestedGroups:
|
54
|
+
Max: 5
|
55
|
+
|
56
|
+
# Offense count: 2
|
57
|
+
# Cop supports --auto-correct.
|
58
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
|
59
|
+
# Whitelist: present?, blank?, presence, try, try!
|
60
|
+
Style/SafeNavigation:
|
61
|
+
Exclude:
|
62
|
+
- 'lib/reek/ast/node.rb'
|
63
|
+
- 'lib/reek/ast/sexp_extensions/module.rb'
|
data/.simplecov
CHANGED
@@ -2,10 +2,13 @@ SimpleCov.start do
|
|
2
2
|
track_files 'lib/**/*.rb'
|
3
3
|
add_filter 'lib/reek/version.rb' # version.rb is loaded too early to test
|
4
4
|
add_filter 'lib/reek/cli/options.rb' # tested mostly via integration tests
|
5
|
+
add_filter 'spec/'
|
6
|
+
add_filter 'samples/'
|
7
|
+
coverage_dir 'tmp/coverage'
|
5
8
|
end
|
6
9
|
|
7
10
|
SimpleCov.at_exit do
|
8
11
|
SimpleCov.result.format!
|
9
|
-
SimpleCov.minimum_coverage 98.
|
12
|
+
SimpleCov.minimum_coverage 98.88
|
10
13
|
SimpleCov.minimum_coverage_by_file 81.4
|
11
14
|
end
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -5,20 +5,18 @@ gemspec
|
|
5
5
|
ruby RUBY_VERSION
|
6
6
|
|
7
7
|
group :development do
|
8
|
-
gem 'activesupport',
|
9
|
-
gem 'aruba',
|
10
|
-
gem '
|
11
|
-
gem '
|
12
|
-
gem '
|
13
|
-
gem 'rake',
|
14
|
-
gem 'rspec',
|
15
|
-
gem '
|
16
|
-
gem '
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
gem 'rubocop-rspec', '~> 1.20'
|
21
|
-
end
|
8
|
+
gem 'activesupport', '>= 4.2'
|
9
|
+
gem 'aruba', '~> 0.14.0'
|
10
|
+
gem 'cucumber', '~> 3.0'
|
11
|
+
gem 'factory_bot', '~> 4.0'
|
12
|
+
gem 'kramdown', '~> 1.17'
|
13
|
+
gem 'rake', '~> 12.0'
|
14
|
+
gem 'rspec', '~> 3.0'
|
15
|
+
gem 'rspec-benchmark', '~> 0.3.0'
|
16
|
+
gem 'rubocop', '~> 0.59.1'
|
17
|
+
gem 'rubocop-rspec', '~> 1.29.0'
|
18
|
+
gem 'simplecov', '~> 0.16.1'
|
19
|
+
gem 'yard', '~> 0.9.5'
|
22
20
|
|
23
21
|
platforms :mri do
|
24
22
|
gem 'redcarpet', '~> 3.4.0'
|
@@ -26,11 +24,8 @@ group :development do
|
|
26
24
|
end
|
27
25
|
|
28
26
|
group :debugging do
|
29
|
-
# Fixing https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X#option-4-using-a-pure-ruby-readline-implementation
|
30
27
|
gem 'pry'
|
31
|
-
gem 'rb-readline', '~> 0.5.3'
|
32
28
|
platforms :mri do
|
33
29
|
gem 'pry-byebug'
|
34
|
-
gem 'pry-stack_explorer'
|
35
30
|
end
|
36
31
|
end
|
data/README.md
CHANGED
@@ -407,6 +407,16 @@ end
|
|
407
407
|
|
408
408
|
This is an incredibly powerful feature and further explained under [Smell Suppresion](docs/Smell-Suppression.md).
|
409
409
|
|
410
|
+
#### Debugging trouble with the configuration
|
411
|
+
|
412
|
+
With Reeks dynamic mechanism of finding a configuration file you might run into a situation where you are not
|
413
|
+
100% sure what configuration file Reek is using. E.g. you have a project specific configuration file in your
|
414
|
+
project root and also another Reek configuration in your HOME directory that you use for all your other projects
|
415
|
+
and for whatever reasons Reek seems to be using another configuration file than the one you assumed it would.
|
416
|
+
|
417
|
+
In this case you can pass the flag `--show-configuration-path` to Reek which will cause Reek to output the path
|
418
|
+
to the configuration file it is using.
|
419
|
+
|
410
420
|
### Generating a 'todo' list
|
411
421
|
|
412
422
|
Integrating tools like Reek into an existing larger codebase can be daunting when you have to fix
|
@@ -420,29 +430,28 @@ suppress all smell warnings for the current codebase:
|
|
420
430
|
reek --todo lib/
|
421
431
|
```
|
422
432
|
|
423
|
-
This will create the file '.
|
433
|
+
This will create the file '.reek.yml' in your current working directory.
|
424
434
|
|
425
435
|
You can then use this as your configuration - since your working directory
|
426
436
|
probably is your project root in most cases you don't have to tell Reek
|
427
|
-
explicitly to use '.
|
437
|
+
explicitly to use '.reek.yml' because Reek will automatically pick it up
|
428
438
|
and use it as configuration file. See [Configuration Loading](#configuration-loading) above.
|
429
439
|
|
430
|
-
If for whatever reasons you decide to put '.
|
440
|
+
If for whatever reasons you decide to put '.reek.yml' somewhere else where
|
431
441
|
Reek won't pick it up automatically you need to tell Reek explicitly to do so
|
432
442
|
via:
|
433
443
|
|
434
444
|
```Bash
|
435
|
-
reek -c whatever/.
|
445
|
+
reek -c whatever/.reek.yml lib/
|
436
446
|
```
|
437
447
|
|
438
448
|
It's important to understand that the number one use case of the `--todo` flag
|
439
449
|
is to be run once at the beginning of the introduction of Reek to ease the transition.
|
440
|
-
If you find yourself re-
|
450
|
+
If you find yourself wanting to re-run Reek with the `--todo` flag in order to silence a lot of new warnings
|
441
451
|
you're defeating the purpose of both the `--todo` flag and of Reek itself.
|
442
452
|
|
443
|
-
As a consequence, running Reek with the `--todo` flag again will overwrite '.
|
444
|
-
|
445
|
-
without taking **any** other configuration file you might have into account.
|
453
|
+
As a consequence, running Reek with the `--todo` flag again will not overwrite an existing '.reek.yml'
|
454
|
+
and instead abort execution. It also will not take **any** other configuration file you might have into account.
|
446
455
|
|
447
456
|
This means that when you run
|
448
457
|
|
@@ -450,8 +459,10 @@ This means that when you run
|
|
450
459
|
reek -c other_configuration.reek --todo lib/
|
451
460
|
```
|
452
461
|
|
453
|
-
`other_configuration.reek` will simply be ignored
|
454
|
-
|
462
|
+
`other_configuration.reek` will simply be ignored.
|
463
|
+
|
464
|
+
Of course you can always just delete the existing .reek.yml file and then run Reek with the `--todo` flag
|
465
|
+
but keep in mind that this is not the intended use case of this feature.
|
455
466
|
|
456
467
|
## Usage
|
457
468
|
|
@@ -492,16 +503,6 @@ bundle exec rake
|
|
492
503
|
|
493
504
|
This will run the tests (RSpec and Cucumber), RuboCop and Reek itself.
|
494
505
|
|
495
|
-
You can also run:
|
496
|
-
|
497
|
-
```
|
498
|
-
bundle exec rake ci
|
499
|
-
```
|
500
|
-
|
501
|
-
This will run everything the default task runs and also
|
502
|
-
[Ataru](https://github.com/CodePadawans/ataru). This is the task that we run on
|
503
|
-
Travis as well and that determines if your pull request is green or red.
|
504
|
-
|
505
506
|
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:
|
506
507
|
|
507
508
|
```
|
@@ -521,15 +522,6 @@ require 'pry'
|
|
521
522
|
binding.pry
|
522
523
|
```
|
523
524
|
|
524
|
-
If you do this, you need to also run the specs with `DEBUG=1` set, e.g.:
|
525
|
-
|
526
|
-
```
|
527
|
-
DEBUG=1 bundle exec rspec spec/your/file_spec.rb:23
|
528
|
-
```
|
529
|
-
|
530
|
-
This is necessary because normally all specs run with a timeout of 5 seconds,
|
531
|
-
which isn't much if you're busy using Pry.
|
532
|
-
|
533
525
|
Have a look at our [Developer API](docs/API.md) for more inspiration.
|
534
526
|
|
535
527
|
From then on you should check out:
|
data/Rakefile
CHANGED
@@ -6,11 +6,11 @@ Dir['tasks/**/*.rake'].each { |t| load t }
|
|
6
6
|
task :ci do
|
7
7
|
[
|
8
8
|
'test:spec',
|
9
|
+
'test:performance',
|
9
10
|
'configuration:update_default_configuration',
|
10
11
|
'test:features',
|
11
12
|
:rubocop,
|
12
|
-
'test:quality'
|
13
|
-
:ataru
|
13
|
+
'test:quality'
|
14
14
|
].each do |name|
|
15
15
|
puts "\n=== Running #{name}...\n"
|
16
16
|
Rake::Task[name].invoke
|
@@ -1,6 +1,7 @@
|
|
1
1
|
def init
|
2
2
|
super
|
3
3
|
return unless show_api_marker_section?
|
4
|
+
|
4
5
|
if sections.first
|
5
6
|
sections.first.place(:api_marker).before(:private)
|
6
7
|
else
|
@@ -10,6 +11,7 @@ end
|
|
10
11
|
|
11
12
|
def api_marker
|
12
13
|
return if object.type == :root
|
14
|
+
|
13
15
|
erb(:private) unless ['public', 'private'].include? api_text
|
14
16
|
end
|
15
17
|
|
@@ -23,6 +25,7 @@ end
|
|
23
25
|
|
24
26
|
def show_api_marker_section?
|
25
27
|
return false if object.type == :root
|
28
|
+
|
26
29
|
case api_text
|
27
30
|
when 'public'
|
28
31
|
false
|
@@ -20,7 +20,7 @@ Feature: Reek can be controlled using command-line options
|
|
20
20
|
Then the exit status is 23
|
21
21
|
|
22
22
|
Scenario: return given status code when using --success-exit-code
|
23
|
-
Given the clean file
|
23
|
+
Given the clean file "clean.rb"
|
24
24
|
When I run reek clean.rb --success-exit-code 42
|
25
25
|
Then the exit status is 42
|
26
26
|
|
@@ -43,7 +43,7 @@ Feature: Reek can be controlled using command-line options
|
|
43
43
|
-c, --config FILE Read configuration options from FILE
|
44
44
|
--smell SMELL Only look for a specific smell.
|
45
45
|
Call it like this: reek --smell MissingSafeMethod source.rb
|
46
|
-
Check out https://github.com/troessner/reek/blob/v5.0
|
46
|
+
Check out https://github.com/troessner/reek/blob/v5.1.0/docs/Code-Smells.md for a list of smells
|
47
47
|
--stdin-filename FILE When passing code in via pipe, assume this filename when checking file or directory rules in the config.
|
48
48
|
|
49
49
|
Generate a todo list:
|
@@ -62,6 +62,8 @@ Feature: Reek can be controlled using command-line options
|
|
62
62
|
--[no-]color Use colors for the output (default: true)
|
63
63
|
-V, --[no-]empty-headings Show headings for smell-free source files (default: false)
|
64
64
|
-U, --[no-]documentation Show link to related documentation page for each smell (default: true)
|
65
|
+
--[no-]show-configuration-path
|
66
|
+
Show which configuration file Reek is using (default: false)
|
65
67
|
-n, --[no-]line-numbers Show line numbers in the output (default: true)
|
66
68
|
-s, --single-line Show location in editor-compatible single-line-per-smell format
|
67
69
|
-P, --[no-]progress Show progress of each source as it is examined (default: true)
|
@@ -118,5 +120,5 @@ Feature: Reek can be controlled using command-line options
|
|
118
120
|
UnusedPrivateMethod
|
119
121
|
UtilityFunction
|
120
122
|
|
121
|
-
Check out https://github.com/troessner/reek/blob/v5.0
|
123
|
+
Check out https://github.com/troessner/reek/blob/v5.1.0/docs/Code-Smells.md for a details on each detector
|
122
124
|
"""
|
@@ -5,7 +5,7 @@ Feature: Validate schema
|
|
5
5
|
|
6
6
|
Scenario: Our generated default configuration
|
7
7
|
Given our default configuration file
|
8
|
-
And the clean file
|
8
|
+
And the clean file "clean.rb"
|
9
9
|
When I run reek -c defaults.reek clean.rb
|
10
10
|
Then it succeeds
|
11
11
|
And it reports nothing
|
@@ -37,7 +37,7 @@ Feature: Validate schema
|
|
37
37
|
- lib/legacy
|
38
38
|
- lib/rake/legacy_tasks
|
39
39
|
"""
|
40
|
-
And the clean file
|
40
|
+
And the clean file "clean.rb"
|
41
41
|
When I run reek -c config.reek clean.rb
|
42
42
|
Then it succeeds
|
43
43
|
And it reports nothing
|
@@ -50,7 +50,7 @@ Feature: Validate schema
|
|
50
50
|
DoesNotExist:
|
51
51
|
enabled: true
|
52
52
|
"""
|
53
|
-
And the clean file
|
53
|
+
And the clean file "clean.rb"
|
54
54
|
When I run reek -c config.reek clean.rb
|
55
55
|
Then the exit status indicates an error
|
56
56
|
And stderr reports:
|