reek 1.0.0 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +56 -22
  2. data/config/defaults.reek +3 -5
  3. data/lib/reek.rb +1 -1
  4. data/lib/reek/block_context.rb +27 -5
  5. data/lib/reek/class_context.rb +5 -9
  6. data/lib/reek/code_parser.rb +23 -50
  7. data/lib/reek/method_context.rb +18 -12
  8. data/lib/reek/module_context.rb +1 -1
  9. data/lib/reek/name.rb +8 -1
  10. data/lib/reek/object_refs.rb +2 -3
  11. data/lib/reek/object_source.rb +53 -0
  12. data/lib/reek/report.rb +41 -2
  13. data/lib/reek/sexp_formatter.rb +4 -46
  14. data/lib/reek/smells/large_class.rb +27 -8
  15. data/lib/reek/smells/long_parameter_list.rb +1 -1
  16. data/lib/reek/smells/smells.rb +4 -8
  17. data/lib/reek/source.rb +19 -8
  18. data/lib/reek/stop_context.rb +4 -16
  19. data/lib/reek/yield_call_context.rb +1 -3
  20. data/reek.gemspec +11 -9
  21. data/spec/reek/block_context_spec.rb +40 -0
  22. data/spec/reek/class_context_spec.rb +11 -40
  23. data/spec/reek/code_context_spec.rb +2 -1
  24. data/spec/reek/code_parser_spec.rb +0 -10
  25. data/spec/reek/config_spec.rb +2 -2
  26. data/spec/reek/method_context_spec.rb +14 -0
  27. data/spec/reek/name_spec.rb +13 -0
  28. data/spec/reek/object_refs_spec.rb +11 -9
  29. data/spec/reek/report_spec.rb +1 -1
  30. data/spec/reek/singleton_method_context_spec.rb +1 -1
  31. data/spec/reek/smells/duplication_spec.rb +2 -2
  32. data/spec/reek/smells/feature_envy_spec.rb +132 -36
  33. data/spec/reek/smells/large_class_spec.rb +48 -47
  34. data/spec/reek/smells/long_method_spec.rb +1 -1
  35. data/spec/reek/smells/long_parameter_list_spec.rb +4 -11
  36. data/spec/reek/smells/uncommunicative_name_spec.rb +6 -1
  37. data/spec/reek/smells/utility_function_spec.rb +6 -9
  38. data/spec/{samples → slow}/inline_spec.rb +13 -10
  39. data/spec/{samples → slow}/optparse_spec.rb +20 -12
  40. data/spec/{samples → slow}/redcloth_spec.rb +16 -8
  41. data/spec/{integration → slow}/reek_source_spec.rb +0 -0
  42. data/spec/{samples → slow/samples}/inline.rb +0 -0
  43. data/spec/{samples → slow/samples}/optparse.rb +0 -0
  44. data/spec/{samples → slow/samples}/redcloth.rb +0 -0
  45. data/spec/{integration → slow}/script_spec.rb +0 -0
  46. data/spec/slow/source_list_spec.rb +40 -0
  47. data/spec/spec_helper.rb +2 -0
  48. data/tasks/rspec.rake +1 -1
  49. metadata +30 -15
  50. data/spec/reek/sexp_formatter_spec.rb +0 -31
@@ -9,3 +9,5 @@ rescue LoadError
9
9
  end
10
10
 
11
11
  require 'reek/spec'
12
+
13
+ SAMPLES_DIR = 'spec/slow/samples' unless Object.const_defined?('SAMPLES_DIR')
@@ -3,7 +3,7 @@ require 'spec/rake/spectask'
3
3
 
4
4
  namespace 'rspec' do
5
5
  FAST = FileList['spec/reek/**/*_spec.rb']
6
- SLOW = FileList['spec/integration/**/*_spec.rb', 'spec/samples/**/*_spec.rb']
6
+ SLOW = FileList['spec/slow/**/*_spec.rb']
7
7
 
8
8
  Spec::Rake::SpecTask.new('fast') do |t|
9
9
  t.spec_files = FAST
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.0.0
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Rutherford
@@ -9,18 +9,28 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-05 00:00:00 +01:00
12
+ date: 2009-05-19 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: ParseTree
16
+ name: ruby_parser
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: "3.0"
23
+ version: "2.0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: ruby2ruby
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: "1.2"
24
34
  version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: sexp_processor
@@ -59,6 +69,7 @@ files:
59
69
  - lib/reek/module_context.rb
60
70
  - lib/reek/name.rb
61
71
  - lib/reek/object_refs.rb
72
+ - lib/reek/object_source.rb
62
73
  - lib/reek/options.rb
63
74
  - lib/reek/rake_task.rb
64
75
  - lib/reek/report.rb
@@ -82,8 +93,7 @@ files:
82
93
  - lib/reek/stop_context.rb
83
94
  - lib/reek/yield_call_context.rb
84
95
  - reek.gemspec
85
- - spec/integration/reek_source_spec.rb
86
- - spec/integration/script_spec.rb
96
+ - spec/reek/block_context_spec.rb
87
97
  - spec/reek/class_context_spec.rb
88
98
  - spec/reek/code_context_spec.rb
89
99
  - spec/reek/code_parser_spec.rb
@@ -91,10 +101,10 @@ files:
91
101
  - spec/reek/if_context_spec.rb
92
102
  - spec/reek/method_context_spec.rb
93
103
  - spec/reek/module_context_spec.rb
104
+ - spec/reek/name_spec.rb
94
105
  - spec/reek/object_refs_spec.rb
95
106
  - spec/reek/options_spec.rb
96
107
  - spec/reek/report_spec.rb
97
- - spec/reek/sexp_formatter_spec.rb
98
108
  - spec/reek/singleton_method_context_spec.rb
99
109
  - spec/reek/smells/control_couple_spec.rb
100
110
  - spec/reek/smells/duplication_spec.rb
@@ -106,18 +116,23 @@ files:
106
116
  - spec/reek/smells/smell_spec.rb
107
117
  - spec/reek/smells/uncommunicative_name_spec.rb
108
118
  - spec/reek/smells/utility_function_spec.rb
109
- - spec/samples/inline.rb
110
- - spec/samples/inline_spec.rb
111
- - spec/samples/optparse.rb
112
- - spec/samples/optparse_spec.rb
113
- - spec/samples/redcloth.rb
114
- - spec/samples/redcloth_spec.rb
119
+ - spec/slow/inline_spec.rb
120
+ - spec/slow/optparse_spec.rb
121
+ - spec/slow/redcloth_spec.rb
122
+ - spec/slow/reek_source_spec.rb
123
+ - spec/slow/samples/inline.rb
124
+ - spec/slow/samples/optparse.rb
125
+ - spec/slow/samples/redcloth.rb
126
+ - spec/slow/script_spec.rb
127
+ - spec/slow/source_list_spec.rb
115
128
  - spec/spec.opts
116
129
  - spec/spec_helper.rb
117
130
  - tasks/reek.rake
118
131
  - tasks/rspec.rake
119
132
  has_rdoc: true
120
133
  homepage: http://wiki.github.com/kevinrutherford/reek
134
+ licenses: []
135
+
121
136
  post_install_message: |
122
137
 
123
138
  For more information on reek, see http://wiki.github.com/kevinrutherford/reek
@@ -142,9 +157,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
157
  requirements: []
143
158
 
144
159
  rubyforge_project: reek
145
- rubygems_version: 1.3.1
160
+ rubygems_version: 1.3.3
146
161
  signing_key:
147
- specification_version: 2
162
+ specification_version: 3
148
163
  summary: Code smell detector for Ruby
149
164
  test_files: []
150
165
 
@@ -1,31 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper.rb'
2
-
3
- require 'reek/code_parser'
4
- require 'reek/sexp_formatter'
5
-
6
- include Reek
7
-
8
- def should_print(example)
9
- it "should format #{example} correctly" do
10
- sexp = CodeParser.parse_tree_for(example)[0]
11
- SexpFormatter.format(sexp).should == example
12
- end
13
- end
14
-
15
- describe SexpFormatter do
16
- should_print 'self'
17
- should_print 'Alpha'
18
- should_print 'Alpha::Beta'
19
- should_print '@@fred'
20
- should_print '`ls`'
21
- should_print 'array[0]'
22
- should_print 'array[0, 1, 2]'
23
- should_print 'obj.method(arg1, arg2)'
24
- should_print 'obj.method'
25
- should_print '$1'
26
- should_print 'o=q.downcase'
27
- should_print 'true'
28
- should_print '"-#{q}xxx#{z.size}"'
29
- should_print '0..5'
30
- should_print '0..temp'
31
- end