rails_best_practices 1.5.3 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/Gemfile.lock +1 -1
  2. data/README.md +11 -7
  3. data/assets/result.html.erb +6 -4
  4. data/lib/rails_best_practices/analyzer.rb +45 -42
  5. data/lib/rails_best_practices/command.rb +36 -9
  6. data/lib/rails_best_practices/core.rb +2 -0
  7. data/lib/rails_best_practices/core/check.rb +52 -18
  8. data/lib/rails_best_practices/core/error.rb +8 -0
  9. data/lib/rails_best_practices/core/helpers.rb +8 -0
  10. data/lib/rails_best_practices/core/modules.rb +39 -0
  11. data/lib/rails_best_practices/core/runner.rb +14 -3
  12. data/lib/rails_best_practices/prepares.rb +9 -0
  13. data/lib/rails_best_practices/prepares/controller_prepare.rb +15 -3
  14. data/lib/rails_best_practices/prepares/helper_prepare.rb +41 -0
  15. data/lib/rails_best_practices/prepares/mailer_prepare.rb +1 -1
  16. data/lib/rails_best_practices/prepares/model_prepare.rb +1 -1
  17. data/lib/rails_best_practices/reviews.rb +1 -0
  18. data/lib/rails_best_practices/reviews/always_add_db_index_review.rb +2 -2
  19. data/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb +13 -3
  20. data/lib/rails_best_practices/reviews/remove_unused_methods_in_helpers_review.rb +47 -0
  21. data/lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb +3 -3
  22. data/lib/rails_best_practices/version.rb +1 -1
  23. data/rails_best_practices.yml +1 -0
  24. data/spec/rails_best_practices/analyzer_spec.rb +3 -3
  25. data/spec/rails_best_practices/core/error_spec.rb +10 -1
  26. data/spec/rails_best_practices/core/helpers_spec.rb +5 -0
  27. data/spec/rails_best_practices/core/modules_spec.rb +26 -0
  28. data/spec/rails_best_practices/prepares/controller_prepare_spec.rb +32 -1
  29. data/spec/rails_best_practices/prepares/helper_prepare_spec.rb +41 -0
  30. data/spec/rails_best_practices/reviews/always_add_db_index_review_spec.rb +11 -11
  31. data/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +15 -15
  32. data/spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb +84 -0
  33. data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +31 -31
  34. metadata +35 -23
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-30 00:00:00.000000000Z
12
+ date: 2011-12-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sexp_processor
16
- requirement: &70221608963020 !ruby/object:Gem::Requirement
16
+ requirement: &70332937464140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70221608963020
24
+ version_requirements: *70332937464140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: progressbar
27
- requirement: &70221608962100 !ruby/object:Gem::Requirement
27
+ requirement: &70332937462120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70221608962100
35
+ version_requirements: *70332937462120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: colored
38
- requirement: &70221608961120 !ruby/object:Gem::Requirement
38
+ requirement: &70332937460520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70221608961120
46
+ version_requirements: *70332937460520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: erubis
49
- requirement: &70221608960060 !ruby/object:Gem::Requirement
49
+ requirement: &70332937459480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70221608960060
57
+ version_requirements: *70332937459480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: i18n
60
- requirement: &70221608959000 !ruby/object:Gem::Requirement
60
+ requirement: &70332937458800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70221608959000
68
+ version_requirements: *70332937458800
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &70221608958140 !ruby/object:Gem::Requirement
71
+ requirement: &70332937458020 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70221608958140
79
+ version_requirements: *70332937458020
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &70221608957540 !ruby/object:Gem::Requirement
82
+ requirement: &70332937457140 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70221608957540
90
+ version_requirements: *70332937457140
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec
93
- requirement: &70221608956760 !ruby/object:Gem::Requirement
93
+ requirement: &70332937456320 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70221608956760
101
+ version_requirements: *70332937456320
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: haml
104
- requirement: &70221608955200 !ruby/object:Gem::Requirement
104
+ requirement: &70332937455320 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70221608955200
112
+ version_requirements: *70332937455320
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: bundler
115
- requirement: &70221608954440 !ruby/object:Gem::Requirement
115
+ requirement: &70332937454080 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70221608954440
123
+ version_requirements: *70332937454080
124
124
  description: a code metric tool for rails codes, written in Ruby.
125
125
  email:
126
126
  - flyerhzm@gmail.com
@@ -155,12 +155,14 @@ files:
155
155
  - lib/rails_best_practices/core/checking_visitor.rb
156
156
  - lib/rails_best_practices/core/controllers.rb
157
157
  - lib/rails_best_practices/core/error.rb
158
+ - lib/rails_best_practices/core/helpers.rb
158
159
  - lib/rails_best_practices/core/klasses.rb
159
160
  - lib/rails_best_practices/core/mailers.rb
160
161
  - lib/rails_best_practices/core/methods.rb
161
162
  - lib/rails_best_practices/core/model_associations.rb
162
163
  - lib/rails_best_practices/core/model_attributes.rb
163
164
  - lib/rails_best_practices/core/models.rb
165
+ - lib/rails_best_practices/core/modules.rb
164
166
  - lib/rails_best_practices/core/nil.rb
165
167
  - lib/rails_best_practices/core/routes.rb
166
168
  - lib/rails_best_practices/core/runner.rb
@@ -172,6 +174,7 @@ files:
172
174
  - lib/rails_best_practices/lexicals/remove_trailing_whitespace_check.rb
173
175
  - lib/rails_best_practices/prepares.rb
174
176
  - lib/rails_best_practices/prepares/controller_prepare.rb
177
+ - lib/rails_best_practices/prepares/helper_prepare.rb
175
178
  - lib/rails_best_practices/prepares/mailer_prepare.rb
176
179
  - lib/rails_best_practices/prepares/model_prepare.rb
177
180
  - lib/rails_best_practices/prepares/route_prepare.rb
@@ -193,6 +196,7 @@ files:
193
196
  - lib/rails_best_practices/reviews/overuse_route_customizations_review.rb
194
197
  - lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
195
198
  - lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb
199
+ - lib/rails_best_practices/reviews/remove_unused_methods_in_helpers_review.rb
196
200
  - lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb
197
201
  - lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb
198
202
  - lib/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review.rb
@@ -217,12 +221,14 @@ files:
217
221
  - spec/rails_best_practices/core/checking_visitor_spec.rb
218
222
  - spec/rails_best_practices/core/controllers_spec.rb
219
223
  - spec/rails_best_practices/core/error_spec.rb
224
+ - spec/rails_best_practices/core/helpers_spec.rb
220
225
  - spec/rails_best_practices/core/klasses_spec.rb
221
226
  - spec/rails_best_practices/core/mailers_spec.rb
222
227
  - spec/rails_best_practices/core/methods_spec.rb
223
228
  - spec/rails_best_practices/core/model_associations_spec.rb
224
229
  - spec/rails_best_practices/core/model_attributes_spec.rb
225
230
  - spec/rails_best_practices/core/models_spec.rb
231
+ - spec/rails_best_practices/core/modules_spec.rb
226
232
  - spec/rails_best_practices/core/nil_spec.rb
227
233
  - spec/rails_best_practices/core/routes_spec.rb
228
234
  - spec/rails_best_practices/core/runner_spec.rb
@@ -232,6 +238,7 @@ files:
232
238
  - spec/rails_best_practices/lexicals/remove_tab_check_spec.rb
233
239
  - spec/rails_best_practices/lexicals/remove_trailing_whitespace_check_spec.rb
234
240
  - spec/rails_best_practices/prepares/controller_prepare_spec.rb
241
+ - spec/rails_best_practices/prepares/helper_prepare_spec.rb
235
242
  - spec/rails_best_practices/prepares/mailer_prepare_spec.rb
236
243
  - spec/rails_best_practices/prepares/model_prepare_spec.rb
237
244
  - spec/rails_best_practices/prepares/route_prepare_spec.rb
@@ -252,6 +259,7 @@ files:
252
259
  - spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb
253
260
  - spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
254
261
  - spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb
262
+ - spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb
255
263
  - spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
256
264
  - spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
257
265
  - spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
@@ -284,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
284
292
  version: '0'
285
293
  segments:
286
294
  - 0
287
- hash: 1044082634186330916
295
+ hash: 3626593683703507913
288
296
  required_rubygems_version: !ruby/object:Gem::Requirement
289
297
  none: false
290
298
  requirements:
@@ -304,12 +312,14 @@ test_files:
304
312
  - spec/rails_best_practices/core/checking_visitor_spec.rb
305
313
  - spec/rails_best_practices/core/controllers_spec.rb
306
314
  - spec/rails_best_practices/core/error_spec.rb
315
+ - spec/rails_best_practices/core/helpers_spec.rb
307
316
  - spec/rails_best_practices/core/klasses_spec.rb
308
317
  - spec/rails_best_practices/core/mailers_spec.rb
309
318
  - spec/rails_best_practices/core/methods_spec.rb
310
319
  - spec/rails_best_practices/core/model_associations_spec.rb
311
320
  - spec/rails_best_practices/core/model_attributes_spec.rb
312
321
  - spec/rails_best_practices/core/models_spec.rb
322
+ - spec/rails_best_practices/core/modules_spec.rb
313
323
  - spec/rails_best_practices/core/nil_spec.rb
314
324
  - spec/rails_best_practices/core/routes_spec.rb
315
325
  - spec/rails_best_practices/core/runner_spec.rb
@@ -319,6 +329,7 @@ test_files:
319
329
  - spec/rails_best_practices/lexicals/remove_tab_check_spec.rb
320
330
  - spec/rails_best_practices/lexicals/remove_trailing_whitespace_check_spec.rb
321
331
  - spec/rails_best_practices/prepares/controller_prepare_spec.rb
332
+ - spec/rails_best_practices/prepares/helper_prepare_spec.rb
322
333
  - spec/rails_best_practices/prepares/mailer_prepare_spec.rb
323
334
  - spec/rails_best_practices/prepares/model_prepare_spec.rb
324
335
  - spec/rails_best_practices/prepares/route_prepare_spec.rb
@@ -339,6 +350,7 @@ test_files:
339
350
  - spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb
340
351
  - spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
341
352
  - spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb
353
+ - spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb
342
354
  - spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
343
355
  - spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
344
356
  - spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb