rails_best_practices 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/Gemfile +0 -1
  2. data/README.md +28 -24
  3. data/Rakefile +0 -8
  4. data/install_supported_rubies.sh +2 -3
  5. data/lib/rails_best_practices.rb +8 -7
  6. data/lib/rails_best_practices/core.rb +1 -0
  7. data/lib/rails_best_practices/core/check.rb +68 -0
  8. data/lib/rails_best_practices/core/checking_visitor.rb +18 -15
  9. data/lib/rails_best_practices/core/runner.rb +22 -12
  10. data/lib/rails_best_practices/core/visitable_sexp.rb +6 -2
  11. data/lib/rails_best_practices/prepares.rb +11 -0
  12. data/lib/rails_best_practices/prepares/mailer_prepare.rb +33 -0
  13. data/lib/rails_best_practices/prepares/model_prepare.rb +60 -0
  14. data/lib/rails_best_practices/reviews.rb +23 -0
  15. data/lib/rails_best_practices/{checks/add_model_virtual_attribute_check.rb → reviews/add_model_virtual_attribute_review.rb} +6 -9
  16. data/lib/rails_best_practices/{checks/always_add_db_index_check.rb → reviews/always_add_db_index_review.rb} +9 -12
  17. data/lib/rails_best_practices/{checks/dry_bundler_in_capistrano_check.rb → reviews/dry_bundler_in_capistrano_review.rb} +8 -11
  18. data/lib/rails_best_practices/{checks/isolate_seed_data_check.rb → reviews/isolate_seed_data_review.rb} +11 -14
  19. data/lib/rails_best_practices/{checks/keep_finders_on_their_own_model_check.rb → reviews/keep_finders_on_their_own_model_review.rb} +7 -10
  20. data/lib/rails_best_practices/{checks/law_of_demeter_check.rb → reviews/law_of_demeter_review.rb} +10 -14
  21. data/lib/rails_best_practices/{checks/move_code_into_controller_check.rb → reviews/move_code_into_controller_review.rb} +8 -11
  22. data/lib/rails_best_practices/{checks/move_code_into_helper_check.rb → reviews/move_code_into_helper_review.rb} +7 -10
  23. data/lib/rails_best_practices/{checks/move_code_into_model_check.rb → reviews/move_code_into_model_review.rb} +7 -10
  24. data/lib/rails_best_practices/{checks/move_finder_to_named_scope_check.rb → reviews/move_finder_to_named_scope_review.rb} +7 -10
  25. data/lib/rails_best_practices/{checks/move_model_logic_into_model_check.rb → reviews/move_model_logic_into_model_review.rb} +8 -11
  26. data/lib/rails_best_practices/{checks/needless_deep_nesting_check.rb → reviews/needless_deep_nesting_review.rb} +8 -11
  27. data/lib/rails_best_practices/{checks/not_use_default_route_check.rb → reviews/not_use_default_route_review.rb} +7 -10
  28. data/lib/rails_best_practices/{checks/overuse_route_customizations_check.rb → reviews/overuse_route_customizations_review.rb} +10 -13
  29. data/lib/rails_best_practices/{checks/replace_complex_creation_with_factory_method_check.rb → reviews/replace_complex_creation_with_factory_method_review.rb} +8 -11
  30. data/lib/rails_best_practices/{checks/replace_instance_variable_with_local_variable_check.rb → reviews/replace_instance_variable_with_local_variable_review.rb} +7 -10
  31. data/lib/rails_best_practices/reviews/review.rb +92 -0
  32. data/lib/rails_best_practices/{checks/use_before_filter_check.rb → reviews/use_before_filter_review.rb} +8 -11
  33. data/lib/rails_best_practices/{checks/use_model_association_check.rb → reviews/use_model_association_review.rb} +8 -11
  34. data/lib/rails_best_practices/{checks/use_observer_check.rb → reviews/use_observer_review.rb} +14 -41
  35. data/lib/rails_best_practices/{checks/use_query_attribute_check.rb → reviews/use_query_attribute_review.rb} +20 -16
  36. data/lib/rails_best_practices/{checks/use_say_with_time_in_migrations_check.rb → reviews/use_say_with_time_in_migrations_review.rb} +8 -11
  37. data/lib/rails_best_practices/{checks/use_scope_access_check.rb → reviews/use_scope_access_review.rb} +8 -11
  38. data/lib/rails_best_practices/version.rb +1 -1
  39. data/rails_best_practices.gemspec +3 -2
  40. data/rails_best_practices.yml +22 -22
  41. data/rake_rubies.sh +3 -2
  42. data/spec/rails_best_practices/core/check_spec.rb +41 -0
  43. data/spec/rails_best_practices/core/checking_visitor_spec.rb +78 -0
  44. data/spec/rails_best_practices/core/visitable_sexp_spec.rb +39 -36
  45. data/spec/rails_best_practices/prepares/mailer_prepare_spec.rb +14 -0
  46. data/spec/rails_best_practices/prepares/model_prepare_spec.rb +22 -0
  47. data/spec/rails_best_practices/{checks/add_model_virtual_attribute_check_spec.rb → reviews/add_model_virtual_attribute_review_spec.rb} +17 -25
  48. data/spec/rails_best_practices/{checks/always_add_db_index_check_spec.rb → reviews/always_add_db_index_review_spec.rb} +28 -41
  49. data/spec/rails_best_practices/{checks/dry_bundler_in_capistrano_check_spec.rb → reviews/dry_bundler_in_capistrano_review_spec.rb} +7 -11
  50. data/spec/rails_best_practices/{checks/isolate_seed_data_check_spec.rb → reviews/isolate_seed_data_review_spec.rb} +13 -20
  51. data/spec/rails_best_practices/{checks/keep_finders_on_their_own_model_check_spec.rb → reviews/keep_finders_on_their_own_model_review_spec.rb} +16 -24
  52. data/spec/rails_best_practices/{checks/law_of_demeter_check_spec.rb → reviews/law_of_demeter_review_spec.rb} +24 -26
  53. data/spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb +29 -0
  54. data/spec/rails_best_practices/reviews/move_code_into_helper_review_spec.rb +24 -0
  55. data/spec/rails_best_practices/{checks/move_code_into_model_check_spec.rb → reviews/move_code_into_model_review_spec.rb} +12 -18
  56. data/spec/rails_best_practices/{checks/move_finder_to_named_scope_check_spec.rb → reviews/move_finder_to_named_scope_review_spec.rb} +12 -16
  57. data/spec/rails_best_practices/{checks/move_model_logic_into_model_check_spec.rb → reviews/move_model_logic_into_model_review_spec.rb} +7 -11
  58. data/spec/rails_best_practices/{checks/needless_deep_nesting_check_spec.rb → reviews/needless_deep_nesting_review_spec.rb} +26 -37
  59. data/spec/rails_best_practices/{checks/not_use_default_route_check_spec.rb → reviews/not_use_default_route_review_spec.rb} +13 -19
  60. data/spec/rails_best_practices/{checks/overuse_route_customizations_check_spec.rb → reviews/overuse_route_customizations_review_spec.rb} +27 -39
  61. data/spec/rails_best_practices/{checks/replace_complex_creation_with_factory_method_check_spec.rb → reviews/replace_complex_creation_with_factory_method_review_spec.rb} +10 -15
  62. data/spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb +31 -0
  63. data/spec/rails_best_practices/reviews/review_spec.rb +11 -0
  64. data/spec/rails_best_practices/{checks/use_before_filter_check_spec.rb → reviews/use_before_filter_review_spec.rb} +11 -17
  65. data/spec/rails_best_practices/{checks/use_model_association_check_spec.rb → reviews/use_model_association_review_spec.rb} +12 -18
  66. data/spec/rails_best_practices/{checks/use_observer_check_spec.rb → reviews/use_observer_review_spec.rb} +28 -29
  67. data/spec/rails_best_practices/reviews/use_query_attribute_review_spec.rb +190 -0
  68. data/spec/rails_best_practices/{checks/use_say_with_time_in_migrations_check_spec.rb → reviews/use_say_with_time_in_migrations_review_spec.rb} +14 -23
  69. data/spec/rails_best_practices/{checks/use_scope_access_check_spec.rb → reviews/use_scope_access_review_spec.rb} +28 -37
  70. data/spec/rails_best_practices_spec.rb +4 -4
  71. data/spec/spec_helper.rb +1 -0
  72. metadata +128 -102
  73. data/lib/rails_best_practices/checks.rb +0 -23
  74. data/lib/rails_best_practices/checks/check.rb +0 -203
  75. data/spec/rails_best_practices/checks/check_spec.rb +0 -57
  76. data/spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb +0 -33
  77. data/spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb +0 -28
  78. data/spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb +0 -36
  79. data/spec/rails_best_practices/checks/use_query_attribute_check_spec.rb +0 -192
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck do
4
- before :each do
5
- @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck.new)
6
- end
3
+ describe RailsBestPractices::Reviews::UseSayWithTimeInMigrationsReview do
4
+ let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::Reviews::UseSayWithTimeInMigrationsReview.new) }
7
5
 
8
6
  it "should use say with time in migrations" do
9
7
  content =<<-EOF
@@ -14,11 +12,9 @@ describe RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck do
14
12
  end
15
13
  end
16
14
  EOF
17
- @runner.review('db/migrate/20101010080658_update_users.rb', content)
18
- errors = @runner.errors
19
- errors.should_not be_empty
20
- errors.size.should == 1
21
- errors[0].to_s.should == "db/migrate/20101010080658_update_users.rb:2 - use say with time in migrations"
15
+ runner.review('db/migrate/20101010080658_update_users.rb', content)
16
+ runner.should have(1).errors
17
+ runner.errors[0].to_s.should == "db/migrate/20101010080658_update_users.rb:2 - use say with time in migrations"
22
18
  end
23
19
 
24
20
  it "should use say with time in migrations with create_table" do
@@ -35,11 +31,9 @@ describe RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck do
35
31
  end
36
32
  end
37
33
  EOF
38
- @runner.review('db/migrate/20101010080658_update_users.rb', content)
39
- errors = @runner.errors
40
- errors.should_not be_empty
41
- errors.size.should == 1
42
- errors[0].to_s.should == "db/migrate/20101010080658_update_users.rb:7 - use say with time in migrations"
34
+ runner.review('db/migrate/20101010080658_update_users.rb', content)
35
+ runner.should have(1).errors
36
+ runner.errors[0].to_s.should == "db/migrate/20101010080658_update_users.rb:7 - use say with time in migrations"
43
37
  end
44
38
 
45
39
  it "should not use say with time in migrations" do
@@ -54,9 +48,8 @@ describe RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck do
54
48
  end
55
49
  end
56
50
  EOF
57
- @runner.review('db/migrate/20101010080658_update_users.rb', content)
58
- errors = @runner.errors
59
- errors.should be_empty
51
+ runner.review('db/migrate/20101010080658_update_users.rb', content)
52
+ runner.should have(0).errors
60
53
  end
61
54
 
62
55
  it "should not use say with time when default migration message" do
@@ -69,9 +62,8 @@ describe RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck do
69
62
  end
70
63
  end
71
64
  EOF
72
- @runner.review('db/migrate/20101010080658_create_users.rb', content)
73
- errors = @runner.errors
74
- errors.should be_empty
65
+ runner.review('db/migrate/20101010080658_create_users.rb', content)
66
+ runner.should have(0).errors
75
67
  end
76
68
 
77
69
  it "should not raise an error" do
@@ -106,8 +98,7 @@ describe RailsBestPractices::Checks::UseSayWithTimeInMigrationsCheck do
106
98
  end
107
99
  end
108
100
  EOF
109
- @runner.review('db/migrate/20101010080658_create_users.rb', content)
110
- errors = @runner.errors
111
- errors.should be_empty
101
+ runner.review('db/migrate/20101010080658_create_users.rb', content)
102
+ runner.should have(0).errors
112
103
  end
113
104
  end
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RailsBestPractices::Checks::UseScopeAccessCheck do
4
- before(:each) do
5
- @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::UseScopeAccessCheck.new)
6
- end
3
+ describe RailsBestPractices::Reviews::UseScopeAccessReview do
4
+ let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::Reviews::UseScopeAccessReview.new) }
7
5
 
8
6
  context "if" do
9
7
  it "shoud use scope access" do
@@ -20,10 +18,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
20
18
  end
21
19
  end
22
20
  EOF
23
- @runner.review('app/controllers/posts_controller.rb', content)
24
- errors = @runner.errors
25
- errors.should_not be_empty
26
- errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
21
+ runner.review('app/controllers/posts_controller.rb', content)
22
+ runner.should have(1).errors
23
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
27
24
  end
28
25
 
29
26
  it "shoud use scope access by comparing with id" do
@@ -40,10 +37,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
40
37
  end
41
38
  end
42
39
  EOF
43
- @runner.review('app/controllers/posts_controller.rb', content)
44
- errors = @runner.errors
45
- errors.should_not be_empty
46
- errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
40
+ runner.review('app/controllers/posts_controller.rb', content)
41
+ runner.should have(1).errors
42
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
47
43
  end
48
44
 
49
45
  it "shoud use scope access with current_user ==" do
@@ -60,10 +56,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
60
56
  end
61
57
  end
62
58
  EOF
63
- @runner.review('app/controllers/posts_controller.rb', content)
64
- errors = @runner.errors
65
- errors.should_not be_empty
66
- errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
59
+ runner.review('app/controllers/posts_controller.rb', content)
60
+ runner.should have(1).errors
61
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
67
62
  end
68
63
 
69
64
  it "shoud use scope access by current_user.id ==" do
@@ -80,10 +75,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
80
75
  end
81
76
  end
82
77
  EOF
83
- @runner.review('app/controllers/posts_controller.rb', content)
84
- errors = @runner.errors
85
- errors.should_not be_empty
86
- errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
78
+ runner.review('app/controllers/posts_controller.rb', content)
79
+ runner.should have(1).errors
80
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:7 - use scope access"
87
81
  end
88
82
  end
89
83
 
@@ -102,10 +96,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
102
96
  end
103
97
  end
104
98
  EOF
105
- @runner.review('app/controllers/posts_controller.rb', content)
106
- errors = @runner.errors
107
- errors.should_not be_empty
108
- errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
99
+ runner.review('app/controllers/posts_controller.rb', content)
100
+ runner.should have(1).errors
101
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
109
102
  end
110
103
 
111
104
  it "shoud use scope access by comparing with id" do
@@ -122,10 +115,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
122
115
  end
123
116
  end
124
117
  EOF
125
- @runner.review('app/controllers/posts_controller.rb', content)
126
- errors = @runner.errors
127
- errors.should_not be_empty
128
- errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
118
+ runner.review('app/controllers/posts_controller.rb', content)
119
+ runner.should have(1).errors
120
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
129
121
  end
130
122
 
131
123
  it "shoud use scope access with current_user ==" do
@@ -142,10 +134,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
142
134
  end
143
135
  end
144
136
  EOF
145
- @runner.review('app/controllers/posts_controller.rb', content)
146
- errors = @runner.errors
147
- errors.should_not be_empty
148
- errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
137
+ runner.review('app/controllers/posts_controller.rb', content)
138
+ runner.should have(1).errors
139
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
149
140
  end
150
141
 
151
142
  it "shoud use scope access by current_user.id ==" do
@@ -162,10 +153,9 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
162
153
  end
163
154
  end
164
155
  EOF
165
- @runner.review('app/controllers/posts_controller.rb', content)
166
- errors = @runner.errors
167
- errors.should_not be_empty
168
- errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
156
+ runner.review('app/controllers/posts_controller.rb', content)
157
+ runner.should have(1).errors
158
+ runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:6 - use scope access"
169
159
  end
170
160
 
171
161
  it "should no error in use_scope_access_review" do
@@ -187,7 +177,8 @@ describe RailsBestPractices::Checks::UseScopeAccessCheck do
187
177
  end
188
178
  end
189
179
  EOF
190
- @runner.review('app/controllers/comments_controller.rb', content)
180
+ runner.review('app/controllers/comments_controller.rb', content)
181
+ runner.should have(0).errors
191
182
  end
192
183
  end
193
184
  end
@@ -8,7 +8,7 @@ describe RailsBestPractices do
8
8
  dir = File.dirname(__FILE__)
9
9
  RailsBestPractices.expand_dirs_to_files(dir).should be_include(dir + '/rails_best_practices_spec.rb')
10
10
  RailsBestPractices.expand_dirs_to_files(dir).should be_include(dir + '/rails_best_practices/core/visitable_sexp_spec.rb')
11
- RailsBestPractices.expand_dirs_to_files(dir).should be_include(dir + '/rails_best_practices/checks/check_spec.rb')
11
+ RailsBestPractices.expand_dirs_to_files(dir).should be_include(dir + '/rails_best_practices/reviews/review_spec.rb')
12
12
  end
13
13
  end
14
14
 
@@ -27,9 +27,9 @@ describe RailsBestPractices do
27
27
  end
28
28
 
29
29
  describe "output_terminal_errors" do
30
- check1 = RailsBestPractices::Checks::LawOfDemeterCheck.new
31
- check2 = RailsBestPractices::Checks::UseQueryAttributeCheck.new
32
- runner = RailsBestPractices::Core::Runner.new(check1, check2)
30
+ check1 = RailsBestPractices::Reviews::LawOfDemeterReview.new
31
+ check2 = RailsBestPractices::Reviews::UseQueryAttributeReview.new
32
+ runner = RailsBestPractices::Core::Runner.new(:reviews => [check1, check2])
33
33
  check1.add_error "law of demeter", "app/models/user.rb", 10
34
34
  check2.add_error "use query attribute", "app/models/post.rb", 100
35
35
  RailsBestPractices.runner = runner
@@ -1,4 +1,5 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
 
4
+ require 'rspec/expectations'
4
5
  require 'rails_best_practices'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 6
10
- version: 0.6.6
9
+ - 7
10
+ version: 0.6.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Huang
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-24 00:00:00 +08:00
18
+ date: 2011-02-14 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -30,10 +30,10 @@ dependencies:
30
30
  - 0
31
31
  - 4
32
32
  version: 2.0.4
33
- name: ruby_parser
34
33
  prerelease: false
35
- type: :runtime
36
34
  version_requirements: *id001
35
+ type: :runtime
36
+ name: ruby_parser
37
37
  - !ruby/object:Gem::Dependency
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
@@ -46,10 +46,10 @@ dependencies:
46
46
  - 0
47
47
  - 9
48
48
  version: 0.0.9
49
- name: ruby-progressbar
50
49
  prerelease: false
51
- type: :runtime
52
50
  version_requirements: *id002
51
+ type: :runtime
52
+ name: ruby-progressbar
53
53
  - !ruby/object:Gem::Dependency
54
54
  requirement: &id003 !ruby/object:Gem::Requirement
55
55
  none: false
@@ -61,10 +61,10 @@ dependencies:
61
61
  - 1
62
62
  - 2
63
63
  version: "1.2"
64
- name: colored
65
64
  prerelease: false
66
- type: :runtime
67
65
  version_requirements: *id003
66
+ type: :runtime
67
+ name: colored
68
68
  - !ruby/object:Gem::Dependency
69
69
  requirement: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
@@ -77,10 +77,10 @@ dependencies:
77
77
  - 6
78
78
  - 6
79
79
  version: 2.6.6
80
- name: erubis
81
80
  prerelease: false
82
- type: :runtime
83
81
  version_requirements: *id004
82
+ type: :runtime
83
+ name: erubis
84
84
  - !ruby/object:Gem::Dependency
85
85
  requirement: &id005 !ruby/object:Gem::Requirement
86
86
  none: false
@@ -93,10 +93,10 @@ dependencies:
93
93
  - 0
94
94
  - 18
95
95
  version: 3.0.18
96
- name: haml
97
96
  prerelease: false
98
- type: :runtime
99
97
  version_requirements: *id005
98
+ type: :runtime
99
+ name: haml
100
100
  - !ruby/object:Gem::Dependency
101
101
  requirement: &id006 !ruby/object:Gem::Requirement
102
102
  none: false
@@ -107,10 +107,10 @@ dependencies:
107
107
  segments:
108
108
  - 0
109
109
  version: "0"
110
- name: i18n
111
110
  prerelease: false
112
- type: :runtime
113
111
  version_requirements: *id006
112
+ type: :runtime
113
+ name: i18n
114
114
  - !ruby/object:Gem::Dependency
115
115
  requirement: &id007 !ruby/object:Gem::Requirement
116
116
  none: false
@@ -121,28 +121,42 @@ dependencies:
121
121
  segments:
122
122
  - 0
123
123
  version: "0"
124
- name: activesupport
125
124
  prerelease: false
126
- type: :runtime
127
125
  version_requirements: *id007
126
+ type: :runtime
127
+ name: activesupport
128
128
  - !ruby/object:Gem::Dependency
129
129
  requirement: &id008 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ prerelease: false
139
+ version_requirements: *id008
140
+ type: :development
141
+ name: rake
142
+ - !ruby/object:Gem::Dependency
143
+ requirement: &id009 !ruby/object:Gem::Requirement
130
144
  none: false
131
145
  requirements:
132
146
  - - ~>
133
147
  - !ruby/object:Gem::Version
134
- hash: 13
148
+ hash: 31
135
149
  segments:
136
150
  - 2
151
+ - 4
137
152
  - 0
138
- - 1
139
- version: 2.0.1
140
- name: rspec
153
+ version: 2.4.0
141
154
  prerelease: false
155
+ version_requirements: *id009
142
156
  type: :development
143
- version_requirements: *id008
157
+ name: rspec
144
158
  - !ruby/object:Gem::Dependency
145
- requirement: &id009 !ruby/object:Gem::Requirement
159
+ requirement: &id010 !ruby/object:Gem::Requirement
146
160
  none: false
147
161
  requirements:
148
162
  - - ~>
@@ -152,12 +166,12 @@ dependencies:
152
166
  - 0
153
167
  - 6
154
168
  version: "0.6"
155
- name: watchr
156
169
  prerelease: false
170
+ version_requirements: *id010
157
171
  type: :development
158
- version_requirements: *id009
172
+ name: watchr
159
173
  - !ruby/object:Gem::Dependency
160
- requirement: &id010 !ruby/object:Gem::Requirement
174
+ requirement: &id011 !ruby/object:Gem::Requirement
161
175
  none: false
162
176
  requirements:
163
177
  - - ">="
@@ -168,10 +182,10 @@ dependencies:
168
182
  - 0
169
183
  - 0
170
184
  version: 1.0.0
171
- name: bundler
172
185
  prerelease: false
186
+ version_requirements: *id011
173
187
  type: :development
174
- version_requirements: *id010
188
+ name: bundler
175
189
  description: a code metric tool for rails codes, written in Ruby.
176
190
  email:
177
191
  - flyerhzm@gmail.com
@@ -196,69 +210,77 @@ files:
196
210
  - bin/rails_best_practices
197
211
  - install_supported_rubies.sh
198
212
  - lib/rails_best_practices.rb
199
- - lib/rails_best_practices/checks.rb
200
- - lib/rails_best_practices/checks/add_model_virtual_attribute_check.rb
201
- - lib/rails_best_practices/checks/always_add_db_index_check.rb
202
- - lib/rails_best_practices/checks/check.rb
203
- - lib/rails_best_practices/checks/dry_bundler_in_capistrano_check.rb
204
- - lib/rails_best_practices/checks/isolate_seed_data_check.rb
205
- - lib/rails_best_practices/checks/keep_finders_on_their_own_model_check.rb
206
- - lib/rails_best_practices/checks/law_of_demeter_check.rb
207
- - lib/rails_best_practices/checks/move_code_into_controller_check.rb
208
- - lib/rails_best_practices/checks/move_code_into_helper_check.rb
209
- - lib/rails_best_practices/checks/move_code_into_model_check.rb
210
- - lib/rails_best_practices/checks/move_finder_to_named_scope_check.rb
211
- - lib/rails_best_practices/checks/move_model_logic_into_model_check.rb
212
- - lib/rails_best_practices/checks/needless_deep_nesting_check.rb
213
- - lib/rails_best_practices/checks/not_use_default_route_check.rb
214
- - lib/rails_best_practices/checks/overuse_route_customizations_check.rb
215
- - lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb
216
- - lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb
217
- - lib/rails_best_practices/checks/use_before_filter_check.rb
218
- - lib/rails_best_practices/checks/use_model_association_check.rb
219
- - lib/rails_best_practices/checks/use_observer_check.rb
220
- - lib/rails_best_practices/checks/use_query_attribute_check.rb
221
- - lib/rails_best_practices/checks/use_say_with_time_in_migrations_check.rb
222
- - lib/rails_best_practices/checks/use_scope_access_check.rb
223
213
  - lib/rails_best_practices/command.rb
224
214
  - lib/rails_best_practices/core.rb
215
+ - lib/rails_best_practices/core/check.rb
225
216
  - lib/rails_best_practices/core/checking_visitor.rb
226
217
  - lib/rails_best_practices/core/error.rb
227
218
  - lib/rails_best_practices/core/runner.rb
228
219
  - lib/rails_best_practices/core/visitable_sexp.rb
229
220
  - lib/rails_best_practices/core_ext/enumerable.rb
230
221
  - lib/rails_best_practices/core_ext/nil_class.rb
222
+ - lib/rails_best_practices/prepares.rb
223
+ - lib/rails_best_practices/prepares/mailer_prepare.rb
224
+ - lib/rails_best_practices/prepares/model_prepare.rb
225
+ - lib/rails_best_practices/reviews.rb
226
+ - lib/rails_best_practices/reviews/add_model_virtual_attribute_review.rb
227
+ - lib/rails_best_practices/reviews/always_add_db_index_review.rb
228
+ - lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
229
+ - lib/rails_best_practices/reviews/isolate_seed_data_review.rb
230
+ - lib/rails_best_practices/reviews/keep_finders_on_their_own_model_review.rb
231
+ - lib/rails_best_practices/reviews/law_of_demeter_review.rb
232
+ - lib/rails_best_practices/reviews/move_code_into_controller_review.rb
233
+ - lib/rails_best_practices/reviews/move_code_into_helper_review.rb
234
+ - lib/rails_best_practices/reviews/move_code_into_model_review.rb
235
+ - lib/rails_best_practices/reviews/move_finder_to_named_scope_review.rb
236
+ - lib/rails_best_practices/reviews/move_model_logic_into_model_review.rb
237
+ - lib/rails_best_practices/reviews/needless_deep_nesting_review.rb
238
+ - lib/rails_best_practices/reviews/not_use_default_route_review.rb
239
+ - lib/rails_best_practices/reviews/overuse_route_customizations_review.rb
240
+ - lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb
241
+ - lib/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review.rb
242
+ - lib/rails_best_practices/reviews/review.rb
243
+ - lib/rails_best_practices/reviews/use_before_filter_review.rb
244
+ - lib/rails_best_practices/reviews/use_model_association_review.rb
245
+ - lib/rails_best_practices/reviews/use_observer_review.rb
246
+ - lib/rails_best_practices/reviews/use_query_attribute_review.rb
247
+ - lib/rails_best_practices/reviews/use_say_with_time_in_migrations_review.rb
248
+ - lib/rails_best_practices/reviews/use_scope_access_review.rb
231
249
  - lib/rails_best_practices/version.rb
232
250
  - rails_best_practices.gemspec
233
251
  - rails_best_practices.yml
234
252
  - rake_rubies.sh
235
- - spec/rails_best_practices/checks/add_model_virtual_attribute_check_spec.rb
236
- - spec/rails_best_practices/checks/always_add_db_index_check_spec.rb
237
- - spec/rails_best_practices/checks/check_spec.rb
238
- - spec/rails_best_practices/checks/dry_bundler_in_capistrano_check_spec.rb
239
- - spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb
240
- - spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb
241
- - spec/rails_best_practices/checks/law_of_demeter_check_spec.rb
242
- - spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb
243
- - spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb
244
- - spec/rails_best_practices/checks/move_code_into_model_check_spec.rb
245
- - spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb
246
- - spec/rails_best_practices/checks/move_model_logic_into_model_check_spec.rb
247
- - spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb
248
- - spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
249
- - spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb
250
- - spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb
251
- - spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb
252
- - spec/rails_best_practices/checks/use_before_filter_check_spec.rb
253
- - spec/rails_best_practices/checks/use_model_association_check_spec.rb
254
- - spec/rails_best_practices/checks/use_observer_check_spec.rb
255
- - spec/rails_best_practices/checks/use_query_attribute_check_spec.rb
256
- - spec/rails_best_practices/checks/use_say_with_time_in_migrations_check_spec.rb
257
- - spec/rails_best_practices/checks/use_scope_access_check_spec.rb
253
+ - spec/rails_best_practices/core/check_spec.rb
254
+ - spec/rails_best_practices/core/checking_visitor_spec.rb
258
255
  - spec/rails_best_practices/core/error_spec.rb
259
256
  - spec/rails_best_practices/core/visitable_sexp_spec.rb
260
257
  - spec/rails_best_practices/core_ext/enumerable_spec.rb
261
258
  - spec/rails_best_practices/core_ext/nil_class_spec.rb
259
+ - spec/rails_best_practices/prepares/mailer_prepare_spec.rb
260
+ - spec/rails_best_practices/prepares/model_prepare_spec.rb
261
+ - spec/rails_best_practices/reviews/add_model_virtual_attribute_review_spec.rb
262
+ - spec/rails_best_practices/reviews/always_add_db_index_review_spec.rb
263
+ - spec/rails_best_practices/reviews/dry_bundler_in_capistrano_review_spec.rb
264
+ - spec/rails_best_practices/reviews/isolate_seed_data_review_spec.rb
265
+ - spec/rails_best_practices/reviews/keep_finders_on_their_own_model_review_spec.rb
266
+ - spec/rails_best_practices/reviews/law_of_demeter_review_spec.rb
267
+ - spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
268
+ - spec/rails_best_practices/reviews/move_code_into_helper_review_spec.rb
269
+ - spec/rails_best_practices/reviews/move_code_into_model_review_spec.rb
270
+ - spec/rails_best_practices/reviews/move_finder_to_named_scope_review_spec.rb
271
+ - spec/rails_best_practices/reviews/move_model_logic_into_model_review_spec.rb
272
+ - spec/rails_best_practices/reviews/needless_deep_nesting_review_spec.rb
273
+ - spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb
274
+ - spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb
275
+ - spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
276
+ - spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
277
+ - spec/rails_best_practices/reviews/review_spec.rb
278
+ - spec/rails_best_practices/reviews/use_before_filter_review_spec.rb
279
+ - spec/rails_best_practices/reviews/use_model_association_review_spec.rb
280
+ - spec/rails_best_practices/reviews/use_observer_review_spec.rb
281
+ - spec/rails_best_practices/reviews/use_query_attribute_review_spec.rb
282
+ - spec/rails_best_practices/reviews/use_say_with_time_in_migrations_review_spec.rb
283
+ - spec/rails_best_practices/reviews/use_scope_access_review_spec.rb
262
284
  - spec/rails_best_practices_spec.rb
263
285
  - spec/spec_helper.rb
264
286
  has_rdoc: true
@@ -270,7 +292,7 @@ post_install_message: |
270
292
 
271
293
  rails_best_practices is a code metric tool to check the quality of rails codes.
272
294
 
273
- I highly recommend you go through the Rails Best Practices website first.
295
+ I highly recommend you browse the Rails Best Practices website first.
274
296
 
275
297
  http://rails-bestpractices.com
276
298
 
@@ -307,37 +329,41 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
329
  requirements: []
308
330
 
309
331
  rubyforge_project:
310
- rubygems_version: 1.3.7
332
+ rubygems_version: 1.4.2
311
333
  signing_key:
312
334
  specification_version: 3
313
335
  summary: a code metric tool for rails codes.
314
336
  test_files:
315
- - spec/rails_best_practices/checks/add_model_virtual_attribute_check_spec.rb
316
- - spec/rails_best_practices/checks/always_add_db_index_check_spec.rb
317
- - spec/rails_best_practices/checks/check_spec.rb
318
- - spec/rails_best_practices/checks/dry_bundler_in_capistrano_check_spec.rb
319
- - spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb
320
- - spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb
321
- - spec/rails_best_practices/checks/law_of_demeter_check_spec.rb
322
- - spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb
323
- - spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb
324
- - spec/rails_best_practices/checks/move_code_into_model_check_spec.rb
325
- - spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb
326
- - spec/rails_best_practices/checks/move_model_logic_into_model_check_spec.rb
327
- - spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb
328
- - spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
329
- - spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb
330
- - spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb
331
- - spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb
332
- - spec/rails_best_practices/checks/use_before_filter_check_spec.rb
333
- - spec/rails_best_practices/checks/use_model_association_check_spec.rb
334
- - spec/rails_best_practices/checks/use_observer_check_spec.rb
335
- - spec/rails_best_practices/checks/use_query_attribute_check_spec.rb
336
- - spec/rails_best_practices/checks/use_say_with_time_in_migrations_check_spec.rb
337
- - spec/rails_best_practices/checks/use_scope_access_check_spec.rb
337
+ - spec/rails_best_practices/core/check_spec.rb
338
+ - spec/rails_best_practices/core/checking_visitor_spec.rb
338
339
  - spec/rails_best_practices/core/error_spec.rb
339
340
  - spec/rails_best_practices/core/visitable_sexp_spec.rb
340
341
  - spec/rails_best_practices/core_ext/enumerable_spec.rb
341
342
  - spec/rails_best_practices/core_ext/nil_class_spec.rb
343
+ - spec/rails_best_practices/prepares/mailer_prepare_spec.rb
344
+ - spec/rails_best_practices/prepares/model_prepare_spec.rb
345
+ - spec/rails_best_practices/reviews/add_model_virtual_attribute_review_spec.rb
346
+ - spec/rails_best_practices/reviews/always_add_db_index_review_spec.rb
347
+ - spec/rails_best_practices/reviews/dry_bundler_in_capistrano_review_spec.rb
348
+ - spec/rails_best_practices/reviews/isolate_seed_data_review_spec.rb
349
+ - spec/rails_best_practices/reviews/keep_finders_on_their_own_model_review_spec.rb
350
+ - spec/rails_best_practices/reviews/law_of_demeter_review_spec.rb
351
+ - spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
352
+ - spec/rails_best_practices/reviews/move_code_into_helper_review_spec.rb
353
+ - spec/rails_best_practices/reviews/move_code_into_model_review_spec.rb
354
+ - spec/rails_best_practices/reviews/move_finder_to_named_scope_review_spec.rb
355
+ - spec/rails_best_practices/reviews/move_model_logic_into_model_review_spec.rb
356
+ - spec/rails_best_practices/reviews/needless_deep_nesting_review_spec.rb
357
+ - spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb
358
+ - spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb
359
+ - spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
360
+ - spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
361
+ - spec/rails_best_practices/reviews/review_spec.rb
362
+ - spec/rails_best_practices/reviews/use_before_filter_review_spec.rb
363
+ - spec/rails_best_practices/reviews/use_model_association_review_spec.rb
364
+ - spec/rails_best_practices/reviews/use_observer_review_spec.rb
365
+ - spec/rails_best_practices/reviews/use_query_attribute_review_spec.rb
366
+ - spec/rails_best_practices/reviews/use_say_with_time_in_migrations_review_spec.rb
367
+ - spec/rails_best_practices/reviews/use_scope_access_review_spec.rb
342
368
  - spec/rails_best_practices_spec.rb
343
369
  - spec/spec_helper.rb