rails_best_practices 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile.lock +1 -1
  3. data/README.md +2 -0
  4. data/assets/result.html.erb +25 -2
  5. data/lib/rails_best_practices.rb +20 -9
  6. data/lib/rails_best_practices/core.rb +1 -0
  7. data/lib/rails_best_practices/core/check.rb +106 -25
  8. data/lib/rails_best_practices/core/controllers.rb +2 -1
  9. data/lib/rails_best_practices/core/error.rb +3 -2
  10. data/lib/rails_best_practices/core/klasses.rb +34 -0
  11. data/lib/rails_best_practices/core/mailers.rb +2 -1
  12. data/lib/rails_best_practices/core/methods.rb +113 -9
  13. data/lib/rails_best_practices/core/model_associations.rb +17 -0
  14. data/lib/rails_best_practices/core/model_attributes.rb +16 -0
  15. data/lib/rails_best_practices/core/models.rb +3 -2
  16. data/lib/rails_best_practices/core/nil.rb +9 -1
  17. data/lib/rails_best_practices/core/runner.rb +65 -26
  18. data/lib/rails_best_practices/core_ext/sexp.rb +57 -0
  19. data/lib/rails_best_practices/prepares.rb +12 -1
  20. data/lib/rails_best_practices/prepares/controller_prepare.rb +13 -8
  21. data/lib/rails_best_practices/prepares/mailer_prepare.rb +3 -3
  22. data/lib/rails_best_practices/prepares/model_prepare.rb +44 -16
  23. data/lib/rails_best_practices/reviews.rb +1 -0
  24. data/lib/rails_best_practices/reviews/needless_deep_nesting_review.rb +5 -2
  25. data/lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb +77 -0
  26. data/lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb +2 -2
  27. data/lib/rails_best_practices/reviews/review.rb +1 -1
  28. data/lib/rails_best_practices/version.rb +1 -1
  29. data/rails_best_practices.yml +1 -0
  30. data/spec/fixtures/lib/rails_best_practices/plugins/reviews/not_use_rails_root_review.rb +11 -0
  31. data/spec/rails_best_practices/core/check_spec.rb +22 -0
  32. data/spec/rails_best_practices/core/controllers_spec.rb +1 -1
  33. data/spec/rails_best_practices/core/error_spec.rb +1 -1
  34. data/spec/rails_best_practices/core/klasses_spec.rb +12 -0
  35. data/spec/rails_best_practices/core/mailers_spec.rb +5 -0
  36. data/spec/rails_best_practices/core/methods_spec.rb +26 -4
  37. data/spec/rails_best_practices/core/models_spec.rb +2 -2
  38. data/spec/rails_best_practices/core/runner_spec.rb +13 -0
  39. data/spec/rails_best_practices/core_ext/sexp_spec.rb +26 -2
  40. data/spec/rails_best_practices/prepares/controller_prepare_spec.rb +72 -60
  41. data/spec/rails_best_practices/prepares/mailer_prepare_spec.rb +1 -1
  42. data/spec/rails_best_practices/prepares/model_prepare_spec.rb +150 -59
  43. data/spec/rails_best_practices/reviews/move_model_logic_into_model_review_spec.rb +20 -3
  44. data/spec/rails_best_practices/reviews/needless_deep_nesting_review_spec.rb +14 -0
  45. data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +387 -0
  46. metadata +15 -3
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.0
5
+ version: 1.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Richard Huang
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-06 00:00:00 +08:00
13
+ date: 2011-10-16 00:00:00 +08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -167,6 +167,7 @@ files:
167
167
  - lib/rails_best_practices/core/checking_visitor.rb
168
168
  - lib/rails_best_practices/core/controllers.rb
169
169
  - lib/rails_best_practices/core/error.rb
170
+ - lib/rails_best_practices/core/klasses.rb
170
171
  - lib/rails_best_practices/core/mailers.rb
171
172
  - lib/rails_best_practices/core/methods.rb
172
173
  - lib/rails_best_practices/core/model_associations.rb
@@ -200,6 +201,7 @@ files:
200
201
  - lib/rails_best_practices/reviews/not_use_default_route_review.rb
201
202
  - lib/rails_best_practices/reviews/overuse_route_customizations_review.rb
202
203
  - lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
204
+ - lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb
203
205
  - lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb
204
206
  - lib/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review.rb
205
207
  - lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb
@@ -217,15 +219,19 @@ files:
217
219
  - rails_best_practices.gemspec
218
220
  - rails_best_practices.yml
219
221
  - rake_rubies.sh
222
+ - spec/fixtures/lib/rails_best_practices/plugins/reviews/not_use_rails_root_review.rb
220
223
  - spec/rails_best_practices/core/check_spec.rb
221
224
  - spec/rails_best_practices/core/checking_visitor_spec.rb
222
225
  - spec/rails_best_practices/core/controllers_spec.rb
223
226
  - spec/rails_best_practices/core/error_spec.rb
227
+ - spec/rails_best_practices/core/klasses_spec.rb
228
+ - spec/rails_best_practices/core/mailers_spec.rb
224
229
  - spec/rails_best_practices/core/methods_spec.rb
225
230
  - spec/rails_best_practices/core/model_associations_spec.rb
226
231
  - spec/rails_best_practices/core/model_attributes_spec.rb
227
232
  - spec/rails_best_practices/core/models_spec.rb
228
233
  - spec/rails_best_practices/core/nil_spec.rb
234
+ - spec/rails_best_practices/core/runner_spec.rb
229
235
  - spec/rails_best_practices/core_ext/enumerable_spec.rb
230
236
  - spec/rails_best_practices/core_ext/sexp_spec.rb
231
237
  - spec/rails_best_practices/lexicals/remove_tab_check_spec.rb
@@ -249,6 +255,7 @@ files:
249
255
  - spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb
250
256
  - spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb
251
257
  - spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
258
+ - spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
252
259
  - spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
253
260
  - spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
254
261
  - spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb
@@ -291,7 +298,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
291
298
  requirements:
292
299
  - - ">="
293
300
  - !ruby/object:Gem::Version
294
- hash: -4549595437881865702
301
+ hash: 1140723947848304714
295
302
  segments:
296
303
  - 0
297
304
  version: "0"
@@ -309,15 +316,19 @@ signing_key:
309
316
  specification_version: 3
310
317
  summary: a code metric tool for rails codes.
311
318
  test_files:
319
+ - spec/fixtures/lib/rails_best_practices/plugins/reviews/not_use_rails_root_review.rb
312
320
  - spec/rails_best_practices/core/check_spec.rb
313
321
  - spec/rails_best_practices/core/checking_visitor_spec.rb
314
322
  - spec/rails_best_practices/core/controllers_spec.rb
315
323
  - spec/rails_best_practices/core/error_spec.rb
324
+ - spec/rails_best_practices/core/klasses_spec.rb
325
+ - spec/rails_best_practices/core/mailers_spec.rb
316
326
  - spec/rails_best_practices/core/methods_spec.rb
317
327
  - spec/rails_best_practices/core/model_associations_spec.rb
318
328
  - spec/rails_best_practices/core/model_attributes_spec.rb
319
329
  - spec/rails_best_practices/core/models_spec.rb
320
330
  - spec/rails_best_practices/core/nil_spec.rb
331
+ - spec/rails_best_practices/core/runner_spec.rb
321
332
  - spec/rails_best_practices/core_ext/enumerable_spec.rb
322
333
  - spec/rails_best_practices/core_ext/sexp_spec.rb
323
334
  - spec/rails_best_practices/lexicals/remove_tab_check_spec.rb
@@ -341,6 +352,7 @@ test_files:
341
352
  - spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb
342
353
  - spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb
343
354
  - spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
355
+ - spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
344
356
  - spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
345
357
  - spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
346
358
  - spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb