reek 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +10 -0
- data/History.txt +20 -0
- data/README.md +90 -0
- data/bin/reek +2 -2
- data/config/defaults.reek +34 -4
- data/features/masking_smells.feature +35 -15
- data/features/options.feature +2 -0
- data/features/rake_task.feature +11 -18
- data/features/reports.feature +13 -15
- data/features/samples.feature +90 -105
- data/features/stdin.feature +3 -6
- data/features/step_definitions/reek_steps.rb +8 -4
- data/features/support/env.rb +2 -3
- data/features/yaml.feature +124 -0
- data/lib/reek.rb +8 -4
- data/lib/reek/cli/application.rb +46 -0
- data/lib/reek/cli/command_line.rb +106 -0
- data/lib/reek/cli/help_command.rb +18 -0
- data/lib/reek/cli/reek_command.rb +37 -0
- data/lib/reek/cli/report.rb +91 -0
- data/lib/reek/cli/version_command.rb +19 -0
- data/lib/reek/cli/yaml_command.rb +32 -0
- data/lib/reek/core/block_context.rb +18 -0
- data/lib/reek/core/class_context.rb +23 -0
- data/lib/reek/core/code_context.rb +72 -0
- data/lib/reek/core/code_parser.rb +192 -0
- data/lib/reek/core/detector_stack.rb +29 -0
- data/lib/reek/core/masking_collection.rb +46 -0
- data/lib/reek/core/method_context.rb +132 -0
- data/lib/reek/core/module_context.rb +64 -0
- data/lib/reek/{object_refs.rb → core/object_refs.rb} +8 -6
- data/lib/reek/{singleton_method_context.rb → core/singleton_method_context.rb} +10 -5
- data/lib/reek/core/smell_configuration.rb +66 -0
- data/lib/reek/core/sniffer.rb +110 -0
- data/lib/reek/core/stop_context.rb +26 -0
- data/lib/reek/examiner.rb +88 -0
- data/lib/reek/rake/task.rb +124 -0
- data/lib/reek/smell_warning.rb +69 -13
- data/lib/reek/smells.rb +29 -0
- data/lib/reek/smells/attribute.rb +13 -14
- data/lib/reek/smells/boolean_parameter.rb +33 -0
- data/lib/reek/smells/class_variable.rb +8 -6
- data/lib/reek/smells/control_couple.rb +33 -17
- data/lib/reek/smells/data_clump.rb +10 -6
- data/lib/reek/smells/duplication.rb +24 -14
- data/lib/reek/smells/feature_envy.rb +11 -6
- data/lib/reek/smells/irresponsible_module.rb +28 -0
- data/lib/reek/smells/large_class.rb +9 -7
- data/lib/reek/smells/long_method.rb +6 -5
- data/lib/reek/smells/long_parameter_list.rb +11 -9
- data/lib/reek/smells/long_yield_list.rb +37 -7
- data/lib/reek/smells/nested_iterators.rb +34 -9
- data/lib/reek/smells/simulated_polymorphism.rb +15 -11
- data/lib/reek/smells/smell_detector.rb +24 -12
- data/lib/reek/smells/uncommunicative_method_name.rb +76 -0
- data/lib/reek/smells/uncommunicative_module_name.rb +76 -0
- data/lib/reek/smells/{uncommunicative_name.rb → uncommunicative_parameter_name.rb} +14 -26
- data/lib/reek/smells/uncommunicative_variable_name.rb +90 -0
- data/lib/reek/smells/utility_function.rb +33 -9
- data/lib/reek/source.rb +18 -0
- data/lib/reek/source/code_comment.rb +19 -0
- data/lib/reek/source/config_file.rb +72 -0
- data/lib/reek/source/core_extras.rb +46 -0
- data/lib/reek/source/sexp_formatter.rb +16 -0
- data/lib/reek/source/source_code.rb +44 -0
- data/lib/reek/source/source_file.rb +32 -0
- data/lib/reek/source/source_locator.rb +36 -0
- data/lib/reek/source/tree_dresser.rb +128 -0
- data/lib/reek/spec.rb +51 -0
- data/lib/reek/spec/should_reek.rb +34 -0
- data/lib/reek/spec/should_reek_of.rb +37 -0
- data/lib/reek/spec/should_reek_only_of.rb +36 -0
- data/reek.gemspec +5 -5
- data/spec/reek/{help_command_spec.rb → cli/help_command_spec.rb} +3 -4
- data/spec/reek/{reek_command_spec.rb → cli/reek_command_spec.rb} +8 -7
- data/spec/reek/cli/report_spec.rb +26 -0
- data/spec/reek/{version_command_spec.rb → cli/version_command_spec.rb} +3 -3
- data/spec/reek/cli/yaml_command_spec.rb +47 -0
- data/spec/reek/core/block_context_spec.rb +26 -0
- data/spec/reek/core/class_context_spec.rb +53 -0
- data/spec/reek/{code_context_spec.rb → core/code_context_spec.rb} +15 -37
- data/spec/reek/{code_parser_spec.rb → core/code_parser_spec.rb} +5 -5
- data/spec/reek/{config_spec.rb → core/config_spec.rb} +2 -6
- data/spec/reek/{masking_collection_spec.rb → core/masking_collection_spec.rb} +3 -4
- data/spec/reek/{method_context_spec.rb → core/method_context_spec.rb} +6 -7
- data/spec/reek/core/module_context_spec.rb +42 -0
- data/spec/reek/{object_refs_spec.rb → core/object_refs_spec.rb} +5 -6
- data/spec/reek/core/singleton_method_context_spec.rb +15 -0
- data/spec/reek/core/smell_configuration_spec.rb +11 -0
- data/spec/reek/core/stop_context_spec.rb +17 -0
- data/spec/reek/examiner_spec.rb +42 -0
- data/spec/reek/smell_warning_spec.rb +82 -33
- data/spec/reek/smells/attribute_spec.rb +33 -7
- data/spec/reek/smells/boolean_parameter_spec.rb +76 -0
- data/spec/reek/smells/class_variable_spec.rb +15 -6
- data/spec/reek/smells/control_couple_spec.rb +40 -29
- data/spec/reek/smells/data_clump_spec.rb +28 -7
- data/spec/reek/smells/duplication_spec.rb +47 -41
- data/spec/reek/smells/feature_envy_spec.rb +76 -18
- data/spec/reek/smells/irresponsible_module_spec.rb +37 -0
- data/spec/reek/smells/large_class_spec.rb +91 -56
- data/spec/reek/smells/long_method_spec.rb +32 -7
- data/spec/reek/smells/long_parameter_list_spec.rb +42 -13
- data/spec/reek/smells/long_yield_list_spec.rb +65 -0
- data/spec/reek/smells/nested_iterators_spec.rb +94 -3
- data/spec/reek/smells/simulated_polymorphism_spec.rb +48 -20
- data/spec/reek/smells/smell_detector_shared.rb +28 -0
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +57 -0
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +67 -0
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +61 -0
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +124 -0
- data/spec/reek/smells/utility_function_spec.rb +45 -3
- data/spec/reek/source/code_comment_spec.rb +24 -0
- data/spec/reek/source/object_source_spec.rb +20 -0
- data/spec/reek/{adapters/source_spec.rb → source/source_code_spec.rb} +7 -8
- data/spec/reek/source/tree_dresser_spec.rb +165 -0
- data/spec/reek/spec/should_reek_of_spec.rb +76 -0
- data/spec/reek/spec/should_reek_only_of_spec.rb +89 -0
- data/spec/reek/{adapters → spec}/should_reek_spec.rb +8 -32
- data/spec/samples/all_but_one_masked/clean_one.rb +1 -0
- data/spec/samples/all_but_one_masked/dirty.rb +1 -0
- data/spec/samples/all_but_one_masked/masked.reek +5 -1
- data/spec/samples/clean_due_to_masking/clean_one.rb +1 -0
- data/spec/samples/clean_due_to_masking/clean_three.rb +1 -0
- data/spec/samples/clean_due_to_masking/clean_two.rb +1 -0
- data/spec/samples/clean_due_to_masking/dirty_one.rb +1 -1
- data/spec/samples/clean_due_to_masking/dirty_two.rb +1 -1
- data/spec/samples/clean_due_to_masking/masked.reek +5 -1
- data/spec/samples/corrupt_config_file/dirty.rb +1 -1
- data/spec/samples/empty_config_file/dirty.rb +2 -1
- data/spec/samples/exceptions.reek +1 -1
- data/spec/samples/masked/dirty.rb +2 -1
- data/spec/samples/masked/masked.reek +3 -1
- data/spec/samples/mixed_results/clean_one.rb +1 -0
- data/spec/samples/mixed_results/clean_three.rb +1 -0
- data/spec/samples/mixed_results/clean_two.rb +1 -0
- data/spec/samples/mixed_results/dirty_one.rb +1 -0
- data/spec/samples/mixed_results/dirty_two.rb +1 -0
- data/spec/samples/not_quite_masked/dirty.rb +2 -1
- data/spec/samples/not_quite_masked/masked.reek +1 -1
- data/spec/samples/overrides/masked/dirty.rb +2 -1
- data/spec/samples/overrides/masked/lower.reek +3 -1
- data/spec/samples/three_clean_files/clean_one.rb +1 -0
- data/spec/samples/three_clean_files/clean_three.rb +1 -0
- data/spec/samples/three_clean_files/clean_two.rb +1 -0
- data/spec/samples/two_smelly_files/dirty_one.rb +2 -1
- data/spec/samples/two_smelly_files/dirty_two.rb +2 -1
- data/spec/spec_helper.rb +1 -2
- data/tasks/reek.rake +2 -2
- data/tasks/test.rake +12 -3
- metadata +81 -62
- data/README.rdoc +0 -84
- data/lib/reek/adapters/application.rb +0 -46
- data/lib/reek/adapters/command_line.rb +0 -77
- data/lib/reek/adapters/config_file.rb +0 -31
- data/lib/reek/adapters/core_extras.rb +0 -64
- data/lib/reek/adapters/rake_task.rb +0 -121
- data/lib/reek/adapters/report.rb +0 -86
- data/lib/reek/adapters/source.rb +0 -72
- data/lib/reek/adapters/spec.rb +0 -133
- data/lib/reek/block_context.rb +0 -62
- data/lib/reek/class_context.rb +0 -41
- data/lib/reek/code_context.rb +0 -68
- data/lib/reek/code_parser.rb +0 -203
- data/lib/reek/configuration.rb +0 -57
- data/lib/reek/detector_stack.rb +0 -37
- data/lib/reek/help_command.rb +0 -14
- data/lib/reek/if_context.rb +0 -18
- data/lib/reek/masking_collection.rb +0 -33
- data/lib/reek/method_context.rb +0 -138
- data/lib/reek/module_context.rb +0 -49
- data/lib/reek/name.rb +0 -57
- data/lib/reek/reek_command.rb +0 -28
- data/lib/reek/sexp_formatter.rb +0 -10
- data/lib/reek/sniffer.rb +0 -177
- data/lib/reek/stop_context.rb +0 -35
- data/lib/reek/tree_dresser.rb +0 -82
- data/lib/reek/version_command.rb +0 -14
- data/lib/reek/yield_call_context.rb +0 -12
- data/spec/reek/adapters/report_spec.rb +0 -31
- data/spec/reek/adapters/should_reek_of_spec.rb +0 -138
- data/spec/reek/adapters/should_reek_only_of_spec.rb +0 -87
- data/spec/reek/block_context_spec.rb +0 -65
- data/spec/reek/class_context_spec.rb +0 -161
- data/spec/reek/configuration_spec.rb +0 -12
- data/spec/reek/if_context_spec.rb +0 -17
- data/spec/reek/module_context_spec.rb +0 -46
- data/spec/reek/name_spec.rb +0 -37
- data/spec/reek/object_source_spec.rb +0 -23
- data/spec/reek/singleton_method_context_spec.rb +0 -16
- data/spec/reek/smells/smell_detector_spec.rb +0 -36
- data/spec/reek/smells/uncommunicative_name_spec.rb +0 -146
- data/spec/reek/sniffer_spec.rb +0 -11
- data/spec/reek/stop_context_spec.rb +0 -33
- data/spec/reek/tree_dresser_spec.rb +0 -20
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
2
1
|
|
3
2
|
require 'rubygems'
|
4
3
|
begin
|
@@ -10,6 +9,6 @@ end
|
|
10
9
|
|
11
10
|
require 'spec/autorun'
|
12
11
|
|
13
|
-
require 'reek
|
12
|
+
require File.join((File.dirname(File.dirname(File.expand_path(__FILE__)))), 'lib', 'reek', 'spec')
|
14
13
|
|
15
14
|
SAMPLES_DIR = 'spec/samples' unless Object.const_defined?('SAMPLES_DIR')
|
data/tasks/reek.rake
CHANGED
data/tasks/test.rake
CHANGED
@@ -14,6 +14,13 @@ namespace 'test' do
|
|
14
14
|
t.rcov = false
|
15
15
|
end
|
16
16
|
|
17
|
+
desc 'Tests various release attributes of the gem'
|
18
|
+
Spec::Rake::SpecTask.new('gem') do |t|
|
19
|
+
t.spec_files = FileList['spec/gem/**/*_spec.rb']
|
20
|
+
t.rcov = false
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Tests code quality'
|
17
24
|
Spec::Rake::SpecTask.new('quality') do |t|
|
18
25
|
t.spec_files = FileList['quality/**/*_spec.rb']
|
19
26
|
t.spec_opts = ['--color']
|
@@ -37,14 +44,16 @@ namespace 'test' do
|
|
37
44
|
t.cucumber_opts = "features --format progress --color"
|
38
45
|
end
|
39
46
|
|
40
|
-
desc 'Runs all unit tests
|
47
|
+
desc 'Runs all unit tests and acceptance tests'
|
41
48
|
task 'all' => ['test:spec', 'test:features', 'test:multiruby']
|
49
|
+
|
50
|
+
task 'release' => ['test:gem', 'test:all']
|
42
51
|
end
|
43
52
|
|
44
53
|
task 'clobber_rcov' => 'test:clobber_rcov'
|
45
54
|
|
46
|
-
desc '
|
55
|
+
desc 'Synonym for test:spec'
|
47
56
|
task 'spec' => 'test:spec'
|
48
57
|
|
49
|
-
desc '
|
58
|
+
desc 'Synonym for test:all'
|
50
59
|
task 'test' => 'test:all'
|
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: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Rutherford
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-01 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -55,11 +55,11 @@ extensions: []
|
|
55
55
|
extra_rdoc_files:
|
56
56
|
- History.txt
|
57
57
|
- License.txt
|
58
|
-
- README.rdoc
|
59
58
|
files:
|
59
|
+
- .yardopts
|
60
60
|
- History.txt
|
61
61
|
- License.txt
|
62
|
-
- README.
|
62
|
+
- README.md
|
63
63
|
- Rakefile
|
64
64
|
- bin/reek
|
65
65
|
- config/defaults.reek
|
@@ -72,38 +72,40 @@ files:
|
|
72
72
|
- features/stdin.feature
|
73
73
|
- features/step_definitions/reek_steps.rb
|
74
74
|
- features/support/env.rb
|
75
|
+
- features/yaml.feature
|
75
76
|
- lib/reek.rb
|
76
|
-
- lib/reek/
|
77
|
-
- lib/reek/
|
78
|
-
- lib/reek/
|
79
|
-
- lib/reek/
|
80
|
-
- lib/reek/
|
81
|
-
- lib/reek/
|
82
|
-
- lib/reek/
|
83
|
-
- lib/reek/
|
84
|
-
- lib/reek/
|
85
|
-
- lib/reek/
|
86
|
-
- lib/reek/
|
87
|
-
- lib/reek/
|
88
|
-
- lib/reek/
|
89
|
-
- lib/reek/
|
90
|
-
- lib/reek/
|
91
|
-
- lib/reek/
|
92
|
-
- lib/reek/
|
93
|
-
- lib/reek/
|
94
|
-
- lib/reek/
|
95
|
-
- lib/reek/
|
96
|
-
- lib/reek/
|
97
|
-
- lib/reek/
|
98
|
-
- lib/reek/sexp_formatter.rb
|
99
|
-
- lib/reek/singleton_method_context.rb
|
77
|
+
- lib/reek/cli/application.rb
|
78
|
+
- lib/reek/cli/command_line.rb
|
79
|
+
- lib/reek/cli/help_command.rb
|
80
|
+
- lib/reek/cli/reek_command.rb
|
81
|
+
- lib/reek/cli/report.rb
|
82
|
+
- lib/reek/cli/version_command.rb
|
83
|
+
- lib/reek/cli/yaml_command.rb
|
84
|
+
- lib/reek/core/block_context.rb
|
85
|
+
- lib/reek/core/class_context.rb
|
86
|
+
- lib/reek/core/code_context.rb
|
87
|
+
- lib/reek/core/code_parser.rb
|
88
|
+
- lib/reek/core/detector_stack.rb
|
89
|
+
- lib/reek/core/masking_collection.rb
|
90
|
+
- lib/reek/core/method_context.rb
|
91
|
+
- lib/reek/core/module_context.rb
|
92
|
+
- lib/reek/core/object_refs.rb
|
93
|
+
- lib/reek/core/singleton_method_context.rb
|
94
|
+
- lib/reek/core/smell_configuration.rb
|
95
|
+
- lib/reek/core/sniffer.rb
|
96
|
+
- lib/reek/core/stop_context.rb
|
97
|
+
- lib/reek/examiner.rb
|
98
|
+
- lib/reek/rake/task.rb
|
100
99
|
- lib/reek/smell_warning.rb
|
100
|
+
- lib/reek/smells.rb
|
101
101
|
- lib/reek/smells/attribute.rb
|
102
|
+
- lib/reek/smells/boolean_parameter.rb
|
102
103
|
- lib/reek/smells/class_variable.rb
|
103
104
|
- lib/reek/smells/control_couple.rb
|
104
105
|
- lib/reek/smells/data_clump.rb
|
105
106
|
- lib/reek/smells/duplication.rb
|
106
107
|
- lib/reek/smells/feature_envy.rb
|
108
|
+
- lib/reek/smells/irresponsible_module.rb
|
107
109
|
- lib/reek/smells/large_class.rb
|
108
110
|
- lib/reek/smells/long_method.rb
|
109
111
|
- lib/reek/smells/long_parameter_list.rb
|
@@ -111,55 +113,72 @@ files:
|
|
111
113
|
- lib/reek/smells/nested_iterators.rb
|
112
114
|
- lib/reek/smells/simulated_polymorphism.rb
|
113
115
|
- lib/reek/smells/smell_detector.rb
|
114
|
-
- lib/reek/smells/
|
116
|
+
- lib/reek/smells/uncommunicative_method_name.rb
|
117
|
+
- lib/reek/smells/uncommunicative_module_name.rb
|
118
|
+
- lib/reek/smells/uncommunicative_parameter_name.rb
|
119
|
+
- lib/reek/smells/uncommunicative_variable_name.rb
|
115
120
|
- lib/reek/smells/utility_function.rb
|
116
|
-
- lib/reek/
|
117
|
-
- lib/reek/
|
118
|
-
- lib/reek/
|
119
|
-
- lib/reek/
|
120
|
-
- lib/reek/
|
121
|
+
- lib/reek/source.rb
|
122
|
+
- lib/reek/source/code_comment.rb
|
123
|
+
- lib/reek/source/config_file.rb
|
124
|
+
- lib/reek/source/core_extras.rb
|
125
|
+
- lib/reek/source/sexp_formatter.rb
|
126
|
+
- lib/reek/source/source_code.rb
|
127
|
+
- lib/reek/source/source_file.rb
|
128
|
+
- lib/reek/source/source_locator.rb
|
129
|
+
- lib/reek/source/tree_dresser.rb
|
130
|
+
- lib/reek/spec.rb
|
131
|
+
- lib/reek/spec/should_reek.rb
|
132
|
+
- lib/reek/spec/should_reek_of.rb
|
133
|
+
- lib/reek/spec/should_reek_only_of.rb
|
121
134
|
- reek.gemspec
|
122
|
-
- spec/reek/
|
123
|
-
- spec/reek/
|
124
|
-
- spec/reek/
|
125
|
-
- spec/reek/
|
126
|
-
- spec/reek/
|
127
|
-
- spec/reek/block_context_spec.rb
|
128
|
-
- spec/reek/class_context_spec.rb
|
129
|
-
- spec/reek/code_context_spec.rb
|
130
|
-
- spec/reek/code_parser_spec.rb
|
131
|
-
- spec/reek/config_spec.rb
|
132
|
-
- spec/reek/
|
133
|
-
- spec/reek/
|
134
|
-
- spec/reek/
|
135
|
-
- spec/reek/
|
136
|
-
- spec/reek/
|
137
|
-
- spec/reek/
|
138
|
-
- spec/reek/
|
139
|
-
- spec/reek/
|
140
|
-
- spec/reek/object_source_spec.rb
|
141
|
-
- spec/reek/reek_command_spec.rb
|
142
|
-
- spec/reek/singleton_method_context_spec.rb
|
135
|
+
- spec/reek/cli/help_command_spec.rb
|
136
|
+
- spec/reek/cli/reek_command_spec.rb
|
137
|
+
- spec/reek/cli/report_spec.rb
|
138
|
+
- spec/reek/cli/version_command_spec.rb
|
139
|
+
- spec/reek/cli/yaml_command_spec.rb
|
140
|
+
- spec/reek/core/block_context_spec.rb
|
141
|
+
- spec/reek/core/class_context_spec.rb
|
142
|
+
- spec/reek/core/code_context_spec.rb
|
143
|
+
- spec/reek/core/code_parser_spec.rb
|
144
|
+
- spec/reek/core/config_spec.rb
|
145
|
+
- spec/reek/core/masking_collection_spec.rb
|
146
|
+
- spec/reek/core/method_context_spec.rb
|
147
|
+
- spec/reek/core/module_context_spec.rb
|
148
|
+
- spec/reek/core/object_refs_spec.rb
|
149
|
+
- spec/reek/core/singleton_method_context_spec.rb
|
150
|
+
- spec/reek/core/smell_configuration_spec.rb
|
151
|
+
- spec/reek/core/stop_context_spec.rb
|
152
|
+
- spec/reek/examiner_spec.rb
|
143
153
|
- spec/reek/smell_warning_spec.rb
|
144
154
|
- spec/reek/smells/attribute_spec.rb
|
145
155
|
- spec/reek/smells/behaves_like_variable_detector.rb
|
156
|
+
- spec/reek/smells/boolean_parameter_spec.rb
|
146
157
|
- spec/reek/smells/class_variable_spec.rb
|
147
158
|
- spec/reek/smells/control_couple_spec.rb
|
148
159
|
- spec/reek/smells/data_clump_spec.rb
|
149
160
|
- spec/reek/smells/duplication_spec.rb
|
150
161
|
- spec/reek/smells/feature_envy_spec.rb
|
162
|
+
- spec/reek/smells/irresponsible_module_spec.rb
|
151
163
|
- spec/reek/smells/large_class_spec.rb
|
152
164
|
- spec/reek/smells/long_method_spec.rb
|
153
165
|
- spec/reek/smells/long_parameter_list_spec.rb
|
166
|
+
- spec/reek/smells/long_yield_list_spec.rb
|
154
167
|
- spec/reek/smells/nested_iterators_spec.rb
|
155
168
|
- spec/reek/smells/simulated_polymorphism_spec.rb
|
156
|
-
- spec/reek/smells/
|
157
|
-
- spec/reek/smells/
|
169
|
+
- spec/reek/smells/smell_detector_shared.rb
|
170
|
+
- spec/reek/smells/uncommunicative_method_name_spec.rb
|
171
|
+
- spec/reek/smells/uncommunicative_module_name_spec.rb
|
172
|
+
- spec/reek/smells/uncommunicative_parameter_name_spec.rb
|
173
|
+
- spec/reek/smells/uncommunicative_variable_name_spec.rb
|
158
174
|
- spec/reek/smells/utility_function_spec.rb
|
159
|
-
- spec/reek/
|
160
|
-
- spec/reek/
|
161
|
-
- spec/reek/
|
162
|
-
- spec/reek/
|
175
|
+
- spec/reek/source/code_comment_spec.rb
|
176
|
+
- spec/reek/source/object_source_spec.rb
|
177
|
+
- spec/reek/source/source_code_spec.rb
|
178
|
+
- spec/reek/source/tree_dresser_spec.rb
|
179
|
+
- spec/reek/spec/should_reek_of_spec.rb
|
180
|
+
- spec/reek/spec/should_reek_only_of_spec.rb
|
181
|
+
- spec/reek/spec/should_reek_spec.rb
|
163
182
|
- spec/samples/all_but_one_masked/clean_one.rb
|
164
183
|
- spec/samples/all_but_one_masked/dirty.rb
|
165
184
|
- spec/samples/all_but_one_masked/masked.reek
|
@@ -208,7 +227,7 @@ post_install_message: |
|
|
208
227
|
|
209
228
|
rdoc_options:
|
210
229
|
- --main
|
211
|
-
- README.
|
230
|
+
- README.md
|
212
231
|
require_paths:
|
213
232
|
- lib
|
214
233
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README.rdoc
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
= Reek -- code smell detection for Ruby
|
2
|
-
|
3
|
-
Reek is a tool that examines Ruby classes, modules and methods and
|
4
|
-
reports any code smells it finds. Install it like this:
|
5
|
-
|
6
|
-
$ gem install reek
|
7
|
-
|
8
|
-
and run it like this:
|
9
|
-
|
10
|
-
$ reek [options] [dir_or_source_file]*
|
11
|
-
|
12
|
-
For a full list of command-line options see the Reek
|
13
|
-
wiki[http://wiki.github.com/kevinrutherford/reek/command-line-options]
|
14
|
-
or run
|
15
|
-
|
16
|
-
$ reek --help
|
17
|
-
|
18
|
-
== Example
|
19
|
-
|
20
|
-
Imagine a source file <tt>csv_writer.rb</tt> containing:
|
21
|
-
|
22
|
-
class CsvWriter
|
23
|
-
def write_line(fields)
|
24
|
-
if (fields.length == 0)
|
25
|
-
puts
|
26
|
-
else
|
27
|
-
write_field(fields[0])
|
28
|
-
1.upto(fields.length-1) do |i|
|
29
|
-
print ","
|
30
|
-
write_field(fields[i])
|
31
|
-
end
|
32
|
-
puts
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
#...
|
37
|
-
end
|
38
|
-
|
39
|
-
Reek will report the following code smells in this file:
|
40
|
-
|
41
|
-
$ reek csv_writer.rb
|
42
|
-
CsvWriter#write_line calls fields.length multiple times (Duplication)
|
43
|
-
CsvWriter#write_line has approx 6 statements (Long Method)
|
44
|
-
CsvWriter#write_line/block has the variable name 'i' (Uncommunicative Name)
|
45
|
-
|
46
|
-
== Features
|
47
|
-
|
48
|
-
Reek currently includes checks for some aspects of the following smells:
|
49
|
-
|
50
|
-
* {Control Couple}[http://wiki.github.com/kevinrutherford/reek/control-couple]
|
51
|
-
* {Data Clump}[http://wiki.github.com/kevinrutherford/reek/data-clump]
|
52
|
-
* {Feature Envy}[http://wiki.github.com/kevinrutherford/reek/feature-envy]
|
53
|
-
* {Large Class}[http://wiki.github.com/kevinrutherford/reek/large-class]
|
54
|
-
* {Long Method}[http://wiki.github.com/kevinrutherford/reek/long-method]
|
55
|
-
* {Long Parameter List}[http://wiki.github.com/kevinrutherford/reek/long-parameter-list]
|
56
|
-
* {Simulated Polymorphism}[http://wiki.github.com/kevinrutherford/reek/simulated-polymorphism]
|
57
|
-
* {Uncommunicative Name}[http://wiki.github.com/kevinrutherford/reek/uncommunicative-name]
|
58
|
-
|
59
|
-
...and more. See the Reek wiki[http://wiki.github.com/kevinrutherford/reek/code-smells]
|
60
|
-
for up to date details of exactly what Reek will check in your code.
|
61
|
-
|
62
|
-
=== Tool Integration
|
63
|
-
|
64
|
-
Reek integrates with many of your favourite tools:
|
65
|
-
|
66
|
-
* Use <tt>Reek::RakeTask</tt> to easily add Reek to your Rakefile
|
67
|
-
* Use <tt>Reek::Spec</tt> to add the <tt>should_not reek</tt> custom matcher to your Rspec examples
|
68
|
-
* Reek is fully compliant with Ruby 1.8.6, 1.8.7 and 1.9.1
|
69
|
-
|
70
|
-
=== Dependencies
|
71
|
-
|
72
|
-
Reek makes use of the following other gems:
|
73
|
-
|
74
|
-
* ruby_parser
|
75
|
-
* sexp_processor
|
76
|
-
* ruby2ruby
|
77
|
-
|
78
|
-
== Learn More
|
79
|
-
|
80
|
-
Find out more about Reek from any of the following sources:
|
81
|
-
|
82
|
-
* Browse the Reek documentation at http://wiki.github.com/kevinrutherford/reek
|
83
|
-
* Browse the code or install the latest cutting-edge beta version from http://github.com/kevinrutherford/reek/tree
|
84
|
-
* Read the code API at http://rdoc.info/projects/kevinrutherford/reek
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'reek/adapters/command_line'
|
2
|
-
require 'reek/adapters/source'
|
3
|
-
require 'reek/adapters/core_extras'
|
4
|
-
|
5
|
-
module Reek
|
6
|
-
|
7
|
-
#
|
8
|
-
# Represents an instance of a Reek application.
|
9
|
-
# This is the entry point for all invocations of Reek from the
|
10
|
-
# command line.
|
11
|
-
#
|
12
|
-
class Application
|
13
|
-
|
14
|
-
STATUS_SUCCESS = 0
|
15
|
-
STATUS_ERROR = 1
|
16
|
-
STATUS_SMELLS = 2
|
17
|
-
|
18
|
-
def initialize(argv)
|
19
|
-
@options = Options.new(argv)
|
20
|
-
@status = STATUS_SUCCESS
|
21
|
-
end
|
22
|
-
|
23
|
-
def execute
|
24
|
-
begin
|
25
|
-
cmd = @options.parse
|
26
|
-
cmd.execute(self)
|
27
|
-
rescue Exception => error
|
28
|
-
$stderr.puts "Error: #{error}"
|
29
|
-
@status = STATUS_ERROR
|
30
|
-
end
|
31
|
-
return @status
|
32
|
-
end
|
33
|
-
|
34
|
-
def output(text)
|
35
|
-
puts text
|
36
|
-
end
|
37
|
-
|
38
|
-
def report_success
|
39
|
-
@status = STATUS_SUCCESS
|
40
|
-
end
|
41
|
-
|
42
|
-
def report_smells
|
43
|
-
@status = STATUS_SMELLS
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'reek'
|
3
|
-
require 'reek/adapters/report'
|
4
|
-
require 'reek/help_command'
|
5
|
-
require 'reek/reek_command'
|
6
|
-
require 'reek/version_command'
|
7
|
-
|
8
|
-
module Reek
|
9
|
-
|
10
|
-
class Options
|
11
|
-
|
12
|
-
def initialize(argv)
|
13
|
-
@argv = argv
|
14
|
-
@parser = OptionParser.new
|
15
|
-
@report_class = VerboseReport
|
16
|
-
@show_all = false
|
17
|
-
@command = nil
|
18
|
-
set_options
|
19
|
-
end
|
20
|
-
|
21
|
-
def banner
|
22
|
-
progname = @parser.program_name
|
23
|
-
# SMELL:
|
24
|
-
# The following banner isn't really correct. Help, Version and Reek
|
25
|
-
# are really sub-commands (in the git/svn sense) and so the usage
|
26
|
-
# banner should show three different command-lines. The other
|
27
|
-
# options are all flags for the Reek sub-command.
|
28
|
-
#
|
29
|
-
# reek -h|--help Display a help message
|
30
|
-
#
|
31
|
-
# reek -v|--version Output the tool's version number
|
32
|
-
#
|
33
|
-
# reek [options] files List the smells in the given files
|
34
|
-
# -a|--[no-]show-all Report masked smells
|
35
|
-
# -q|-[no-]quiet Only list files that have smells
|
36
|
-
# files Names of files or dirs to be checked
|
37
|
-
#
|
38
|
-
return <<EOB
|
39
|
-
Usage: #{progname} [options] [files]
|
40
|
-
|
41
|
-
Examples:
|
42
|
-
|
43
|
-
#{progname} lib/*.rb
|
44
|
-
#{progname} -q -a lib
|
45
|
-
cat my_class.rb | #{progname}
|
46
|
-
|
47
|
-
See http://wiki.github.com/kevinrutherford/reek for detailed help.
|
48
|
-
|
49
|
-
EOB
|
50
|
-
end
|
51
|
-
|
52
|
-
def parse
|
53
|
-
@parser.parse!(@argv)
|
54
|
-
@command ||= ReekCommand.new(@argv, @report_class, @show_all)
|
55
|
-
end
|
56
|
-
|
57
|
-
def set_options
|
58
|
-
@parser.banner = banner
|
59
|
-
@parser.separator "Common options:"
|
60
|
-
@parser.on("-h", "--help", "Show this message") do
|
61
|
-
@command = HelpCommand.new(@parser)
|
62
|
-
end
|
63
|
-
@parser.on("-v", "--version", "Show version") do
|
64
|
-
@command = VersionCommand.new(@parser.program_name)
|
65
|
-
end
|
66
|
-
|
67
|
-
@parser.separator "\nReport formatting:"
|
68
|
-
@parser.on("-a", "--[no-]show-all", "Show all smells, including those masked by config settings") do |opt|
|
69
|
-
@show_all = opt
|
70
|
-
end
|
71
|
-
@parser.on("-q", "--[no-]quiet", "Suppress headings for smell-free source files") do |opt|
|
72
|
-
@report_class = opt ? QuietReport : VerboseReport
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|