rails_best_practices 1.19.2 → 1.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.travis.yml +2 -3
  4. data/CHANGELOG.md +7 -7
  5. data/Gemfile +3 -5
  6. data/Gemfile.lock +125 -0
  7. data/Guardfile +2 -0
  8. data/README.md +6 -6
  9. data/Rakefile +2 -17
  10. data/assets/result.html.erb +2 -0
  11. data/lib/rails_best_practices.rb +3 -2
  12. data/lib/rails_best_practices/analyzer.rb +61 -49
  13. data/lib/rails_best_practices/cli.rb +22 -0
  14. data/lib/rails_best_practices/command.rb +1 -131
  15. data/lib/rails_best_practices/core/check.rb +64 -56
  16. data/lib/rails_best_practices/core/checks_loader.rb +24 -23
  17. data/lib/rails_best_practices/core/configs.rb +1 -2
  18. data/lib/rails_best_practices/core/controllers.rb +1 -2
  19. data/lib/rails_best_practices/core/error.rb +1 -1
  20. data/lib/rails_best_practices/core/helpers.rb +1 -2
  21. data/lib/rails_best_practices/core/mailers.rb +1 -2
  22. data/lib/rails_best_practices/core/methods.rb +27 -21
  23. data/lib/rails_best_practices/core/model_associations.rb +10 -5
  24. data/lib/rails_best_practices/core/models.rb +1 -2
  25. data/lib/rails_best_practices/core/modules.rb +1 -1
  26. data/lib/rails_best_practices/core/routes.rb +2 -2
  27. data/lib/rails_best_practices/core/runner.rb +67 -73
  28. data/lib/rails_best_practices/lexicals/long_line_check.rb +7 -3
  29. data/lib/rails_best_practices/option_parser.rb +156 -0
  30. data/lib/rails_best_practices/prepares.rb +1 -1
  31. data/lib/rails_best_practices/prepares/controller_prepare.rb +24 -17
  32. data/lib/rails_best_practices/prepares/gemfile_prepare.rb +2 -2
  33. data/lib/rails_best_practices/prepares/helper_prepare.rb +6 -1
  34. data/lib/rails_best_practices/prepares/initializer_prepare.rb +3 -3
  35. data/lib/rails_best_practices/prepares/mailer_prepare.rb +2 -1
  36. data/lib/rails_best_practices/prepares/model_prepare.rb +63 -23
  37. data/lib/rails_best_practices/prepares/route_prepare.rb +28 -21
  38. data/lib/rails_best_practices/prepares/schema_prepare.rb +1 -1
  39. data/lib/rails_best_practices/reviews/add_model_virtual_attribute_review.rb +38 -34
  40. data/lib/rails_best_practices/reviews/always_add_db_index_review.rb +94 -89
  41. data/lib/rails_best_practices/reviews/check_destroy_return_value_review.rb +15 -5
  42. data/lib/rails_best_practices/reviews/check_save_return_value_review.rb +20 -8
  43. data/lib/rails_best_practices/reviews/default_scope_is_evil_review.rb +1 -1
  44. data/lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb +1 -1
  45. data/lib/rails_best_practices/reviews/hash_syntax_review.rb +16 -16
  46. data/lib/rails_best_practices/reviews/isolate_seed_data_review.rb +12 -12
  47. data/lib/rails_best_practices/reviews/keep_finders_on_their_own_model_review.rb +10 -11
  48. data/lib/rails_best_practices/reviews/law_of_demeter_review.rb +25 -24
  49. data/lib/rails_best_practices/reviews/move_code_into_controller_review.rb +4 -4
  50. data/lib/rails_best_practices/reviews/move_code_into_helper_review.rb +9 -10
  51. data/lib/rails_best_practices/reviews/move_finder_to_named_scope_review.rb +10 -11
  52. data/lib/rails_best_practices/reviews/needless_deep_nesting_review.rb +24 -22
  53. data/lib/rails_best_practices/reviews/not_rescue_exception_review.rb +1 -1
  54. data/lib/rails_best_practices/reviews/not_use_default_route_review.rb +1 -2
  55. data/lib/rails_best_practices/reviews/not_use_time_ago_in_words_review.rb +1 -1
  56. data/lib/rails_best_practices/reviews/overuse_route_customizations_review.rb +8 -8
  57. data/lib/rails_best_practices/reviews/protect_mass_assignment_review.rb +35 -32
  58. data/lib/rails_best_practices/reviews/remove_empty_helpers_review.rb +4 -4
  59. data/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb +26 -19
  60. data/lib/rails_best_practices/reviews/remove_unused_methods_in_helpers_review.rb +12 -10
  61. data/lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb +38 -18
  62. data/lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb +11 -11
  63. data/lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb +77 -74
  64. data/lib/rails_best_practices/reviews/review.rb +2 -1
  65. data/lib/rails_best_practices/reviews/simplify_render_in_controllers_review.rb +2 -3
  66. data/lib/rails_best_practices/reviews/simplify_render_in_views_review.rb +12 -12
  67. data/lib/rails_best_practices/reviews/use_before_filter_review.rb +18 -15
  68. data/lib/rails_best_practices/reviews/use_model_association_review.rb +15 -15
  69. data/lib/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review.rb +24 -22
  70. data/lib/rails_best_practices/reviews/use_observer_review.rb +28 -28
  71. data/lib/rails_best_practices/reviews/use_parentheses_in_method_def_review.rb +6 -6
  72. data/lib/rails_best_practices/reviews/use_query_attribute_review.rb +68 -66
  73. data/lib/rails_best_practices/reviews/use_say_with_time_in_migrations_review.rb +9 -8
  74. data/lib/rails_best_practices/reviews/use_scope_access_review.rb +16 -14
  75. data/lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb +2 -1
  76. data/lib/rails_best_practices/version.rb +1 -1
  77. data/rails_best_practices.gemspec +38 -43
  78. data/spec/fixtures/lib/rails_best_practices/plugins/reviews/not_use_rails_root_review.rb +1 -2
  79. data/spec/rails_best_practices/analyzer_spec.rb +73 -42
  80. data/spec/rails_best_practices/core/check_spec.rb +5 -5
  81. data/spec/rails_best_practices/core/checks_loader_spec.rb +3 -3
  82. data/spec/rails_best_practices/core/configs_spec.rb +1 -1
  83. data/spec/rails_best_practices/core/controllers_spec.rb +1 -1
  84. data/spec/rails_best_practices/core/error_spec.rb +21 -18
  85. data/spec/rails_best_practices/core/except_methods_spec.rb +7 -7
  86. data/spec/rails_best_practices/core/gems_spec.rb +4 -4
  87. data/spec/rails_best_practices/core/helpers_spec.rb +1 -1
  88. data/spec/rails_best_practices/core/klasses_spec.rb +3 -3
  89. data/spec/rails_best_practices/core/mailers_spec.rb +1 -1
  90. data/spec/rails_best_practices/core/methods_spec.rb +6 -6
  91. data/spec/rails_best_practices/core/model_associations_spec.rb +10 -6
  92. data/spec/rails_best_practices/core/model_attributes_spec.rb +4 -4
  93. data/spec/rails_best_practices/core/models_spec.rb +1 -1
  94. data/spec/rails_best_practices/core/modules_spec.rb +5 -5
  95. data/spec/rails_best_practices/core/routes_spec.rb +5 -5
  96. data/spec/rails_best_practices/core/runner_spec.rb +9 -7
  97. data/spec/rails_best_practices/core_ext/erubis_spec.rb +10 -10
  98. data/spec/rails_best_practices/lexicals/long_line_check_spec.rb +32 -31
  99. data/spec/rails_best_practices/lexicals/remove_tab_check_spec.rb +6 -6
  100. data/spec/rails_best_practices/lexicals/remove_trailing_whitespace_check_spec.rb +6 -6
  101. data/spec/rails_best_practices/prepares/config_prepare_spec.rb +2 -2
  102. data/spec/rails_best_practices/prepares/controller_prepare_spec.rb +18 -10
  103. data/spec/rails_best_practices/prepares/gemfile_prepare_spec.rb +17 -17
  104. data/spec/rails_best_practices/prepares/helper_prepare_spec.rb +3 -3
  105. data/spec/rails_best_practices/prepares/initializer_prepare_spec.rb +3 -3
  106. data/spec/rails_best_practices/prepares/mailer_prepare_spec.rb +2 -2
  107. data/spec/rails_best_practices/prepares/model_prepare_spec.rb +79 -43
  108. data/spec/rails_best_practices/prepares/route_prepare_spec.rb +141 -76
  109. data/spec/rails_best_practices/prepares/schema_prepare_spec.rb +2 -2
  110. data/spec/rails_best_practices/reviews/add_model_virtual_attribute_review_spec.rb +18 -12
  111. data/spec/rails_best_practices/reviews/always_add_db_index_review_spec.rb +28 -22
  112. data/spec/rails_best_practices/reviews/check_destroy_return_value_review_spec.rb +15 -13
  113. data/spec/rails_best_practices/reviews/check_save_return_value_review_spec.rb +31 -21
  114. data/spec/rails_best_practices/reviews/default_scope_is_evil_review_spec.rb +6 -6
  115. data/spec/rails_best_practices/reviews/dry_bundler_in_capistrano_review_spec.rb +5 -5
  116. data/spec/rails_best_practices/reviews/hash_syntax_review_spec.rb +13 -13
  117. data/spec/rails_best_practices/reviews/isolate_seed_data_review_spec.rb +7 -7
  118. data/spec/rails_best_practices/reviews/keep_finders_on_their_own_model_review_spec.rb +9 -9
  119. data/spec/rails_best_practices/reviews/law_of_demeter_review_spec.rb +29 -22
  120. data/spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb +6 -6
  121. data/spec/rails_best_practices/reviews/move_code_into_helper_review_spec.rb +11 -6
  122. data/spec/rails_best_practices/reviews/move_code_into_model_review_spec.rb +32 -22
  123. data/spec/rails_best_practices/reviews/move_finder_to_named_scope_review_spec.rb +7 -7
  124. data/spec/rails_best_practices/reviews/move_model_logic_into_model_review_spec.rb +9 -7
  125. data/spec/rails_best_practices/reviews/needless_deep_nesting_review_spec.rb +9 -9
  126. data/spec/rails_best_practices/reviews/not_rescue_exception_review_spec.rb +9 -9
  127. data/spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb +5 -5
  128. data/spec/rails_best_practices/reviews/not_use_time_ago_in_words_review_spec.rb +7 -7
  129. data/spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb +7 -7
  130. data/spec/rails_best_practices/reviews/protect_mass_assignment_review_spec.rb +24 -17
  131. data/spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb +6 -6
  132. data/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +64 -31
  133. data/spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb +21 -14
  134. data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +57 -53
  135. data/spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb +10 -8
  136. data/spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb +20 -14
  137. data/spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb +54 -31
  138. data/spec/rails_best_practices/reviews/simplify_render_in_controllers_review_spec.rb +9 -9
  139. data/spec/rails_best_practices/reviews/simplify_render_in_views_review_spec.rb +13 -13
  140. data/spec/rails_best_practices/reviews/use_before_filter_review_spec.rb +11 -9
  141. data/spec/rails_best_practices/reviews/use_model_association_review_spec.rb +7 -7
  142. data/spec/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review_spec.rb +35 -31
  143. data/spec/rails_best_practices/reviews/use_observer_review_spec.rb +6 -6
  144. data/spec/rails_best_practices/reviews/use_parentheses_in_method_def_review_spec.rb +10 -8
  145. data/spec/rails_best_practices/reviews/use_query_attribute_review_spec.rb +31 -24
  146. data/spec/rails_best_practices/reviews/use_say_with_time_in_migrations_review_spec.rb +15 -11
  147. data/spec/rails_best_practices/reviews/use_scope_access_review_spec.rb +14 -14
  148. data/spec/rails_best_practices/reviews/use_turbo_sprockets_rails3_review_spec.rb +61 -59
  149. metadata +16 -18
@@ -5,9 +5,9 @@ require 'spec_helper'
5
5
  module RailsBestPractices
6
6
  module Reviews
7
7
  describe UseSayWithTimeInMigrationsReview do
8
- let(:runner) { Core::Runner.new(reviews: UseSayWithTimeInMigrationsReview.new) }
8
+ let(:runner) { Core::Runner.new(reviews: described_class.new) }
9
9
 
10
- it 'should use say with time in migrations' do
10
+ it 'uses say with time in migrations' do
11
11
  content = <<-EOF
12
12
  def self.up
13
13
  User.find_each do |user|
@@ -18,10 +18,12 @@ module RailsBestPractices
18
18
  EOF
19
19
  runner.review('db/migrate/20101010080658_update_users.rb', content)
20
20
  expect(runner.errors.size).to eq(1)
21
- expect(runner.errors[0].to_s).to eq('db/migrate/20101010080658_update_users.rb:2 - use say with time in migrations')
21
+ expect(runner.errors[0].to_s).to eq(
22
+ 'db/migrate/20101010080658_update_users.rb:2 - use say with time in migrations'
23
+ )
22
24
  end
23
25
 
24
- it 'should use say with time in migrations with create_table' do
26
+ it 'uses say with time in migrations with create_table' do
25
27
  content = <<-EOF
26
28
  def self.up
27
29
  create_table :users do |t|
@@ -37,10 +39,12 @@ module RailsBestPractices
37
39
  EOF
38
40
  runner.review('db/migrate/20101010080658_update_users.rb', content)
39
41
  expect(runner.errors.size).to eq(1)
40
- expect(runner.errors[0].to_s).to eq('db/migrate/20101010080658_update_users.rb:7 - use say with time in migrations')
42
+ expect(runner.errors[0].to_s).to eq(
43
+ 'db/migrate/20101010080658_update_users.rb:7 - use say with time in migrations'
44
+ )
41
45
  end
42
46
 
43
- it 'should not use say with time in migrations' do
47
+ it 'does not use say with time in migrations' do
44
48
  content = <<-EOF
45
49
  def self.up
46
50
  say_with_time("Initialize first_name and last_name for users") do
@@ -56,7 +60,7 @@ module RailsBestPractices
56
60
  expect(runner.errors.size).to eq(0)
57
61
  end
58
62
 
59
- it 'should not use say with time in migrations when not first code line' do
63
+ it 'does not use say with time in migrations when not first code line' do
60
64
  content = <<-EOF
61
65
  def self.up
62
66
  User.find_each do |user|
@@ -70,7 +74,7 @@ module RailsBestPractices
70
74
  expect(runner.errors.size).to eq(0)
71
75
  end
72
76
 
73
- it 'should not use say with time when default migration message' do
77
+ it 'does not use say with time when default migration message' do
74
78
  content = <<-EOF
75
79
  def self.up
76
80
  create_table :users do |t|
@@ -84,7 +88,7 @@ module RailsBestPractices
84
88
  expect(runner.errors.size).to eq(0)
85
89
  end
86
90
 
87
- it 'should not raise an error' do
91
+ it 'does not raise an error' do
88
92
  content = <<-EOF
89
93
  class AddAdmin < ActiveRecord::Migration
90
94
 
@@ -120,8 +124,8 @@ module RailsBestPractices
120
124
  expect(runner.errors.size).to eq(3)
121
125
  end
122
126
 
123
- it 'should not check ignored files' do
124
- runner = Core::Runner.new(reviews: UseSayWithTimeInMigrationsReview.new(ignored_files: /20101010080658_update_users/))
127
+ it 'does not check ignored files' do
128
+ runner = Core::Runner.new(reviews: described_class.new(ignored_files: /20101010080658_update_users/))
125
129
  content = <<-EOF
126
130
  def self.up
127
131
  User.find_each do |user|
@@ -5,10 +5,10 @@ require 'spec_helper'
5
5
  module RailsBestPractices
6
6
  module Reviews
7
7
  describe UseScopeAccessReview do
8
- let(:runner) { Core::Runner.new(reviews: UseScopeAccessReview.new) }
8
+ let(:runner) { Core::Runner.new(reviews: described_class.new) }
9
9
 
10
10
  context 'if' do
11
- it 'should use scope access' do
11
+ it 'uses scope access' do
12
12
  content = <<-EOF
13
13
  class PostsController < ApplicationController
14
14
  def edit
@@ -26,7 +26,7 @@ module RailsBestPractices
26
26
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
27
27
  end
28
28
 
29
- it 'should use scope access with if in one line' do
29
+ it 'uses scope access with if in one line' do
30
30
  content = <<-EOF
31
31
  class PostsController < ApplicationController
32
32
  def edit
@@ -41,7 +41,7 @@ module RailsBestPractices
41
41
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
42
42
  end
43
43
 
44
- it "should use scope access with '? :'" do
44
+ it "uses scope access with '? :'" do
45
45
  content = <<-EOF
46
46
  class PostsController < ApplicationController
47
47
  def edit
@@ -56,7 +56,7 @@ module RailsBestPractices
56
56
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
57
57
  end
58
58
 
59
- it 'should use scope access by comparing with id' do
59
+ it 'uses scope access by comparing with id' do
60
60
  content = <<-EOF
61
61
  class PostsController < ApplicationController
62
62
  def edit
@@ -74,7 +74,7 @@ module RailsBestPractices
74
74
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
75
75
  end
76
76
 
77
- it 'should use scope access with current_user ==' do
77
+ it 'uses scope access with current_user ==' do
78
78
  content = <<-EOF
79
79
  class PostsController < ApplicationController
80
80
  def edit
@@ -92,7 +92,7 @@ module RailsBestPractices
92
92
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
93
93
  end
94
94
 
95
- it 'should use scope access by current_user.id ==' do
95
+ it 'uses scope access by current_user.id ==' do
96
96
  content = <<-EOF
97
97
  class PostsController < ApplicationController
98
98
  def edit
@@ -112,7 +112,7 @@ module RailsBestPractices
112
112
  end
113
113
 
114
114
  context 'unless' do
115
- it 'should use scope access' do
115
+ it 'uses scope access' do
116
116
  content = <<-EOF
117
117
  class PostsController < ApplicationController
118
118
  def edit
@@ -130,7 +130,7 @@ module RailsBestPractices
130
130
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
131
131
  end
132
132
 
133
- it 'should use scope access by comparing with id' do
133
+ it 'uses scope access by comparing with id' do
134
134
  content = <<-EOF
135
135
  class PostsController < ApplicationController
136
136
  def edit
@@ -148,7 +148,7 @@ module RailsBestPractices
148
148
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
149
149
  end
150
150
 
151
- it 'should use scope access with current_user ==' do
151
+ it 'uses scope access with current_user ==' do
152
152
  content = <<-EOF
153
153
  class PostsController < ApplicationController
154
154
  def edit
@@ -166,7 +166,7 @@ module RailsBestPractices
166
166
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
167
167
  end
168
168
 
169
- it 'should use scope access by current_user.id ==' do
169
+ it 'uses scope access by current_user.id ==' do
170
170
  content = <<-EOF
171
171
  class PostsController < ApplicationController
172
172
  def edit
@@ -184,7 +184,7 @@ module RailsBestPractices
184
184
  expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:5 - use scope access')
185
185
  end
186
186
 
187
- it 'should no error in use_scope_access_review' do
187
+ it 'noes error in use_scope_access_review' do
188
188
  content = <<-EOF
189
189
  class CommentsController < ApplicationController
190
190
  def add_comment
@@ -206,8 +206,8 @@ module RailsBestPractices
206
206
  expect(runner.errors.size).to eq(0)
207
207
  end
208
208
 
209
- it 'should not check ignored files' do
210
- runner = Core::Runner.new(reviews: UseScopeAccessReview.new(ignored_files: /posts_controller/))
209
+ it 'does not check ignored files' do
210
+ runner = Core::Runner.new(reviews: described_class.new(ignored_files: /posts_controller/))
211
211
  content = <<-EOF
212
212
  class PostsController < ApplicationController
213
213
  def edit
@@ -5,21 +5,21 @@ require 'spec_helper'
5
5
  module RailsBestPractices
6
6
  module Reviews
7
7
  describe UseTurboSprocketsRails3Review do
8
- let(:runner) { Core::Runner.new(prepares: Prepares::GemfilePrepare.new, reviews: UseTurboSprocketsRails3Review.new) }
8
+ let(:runner) { Core::Runner.new(prepares: Prepares::GemfilePrepare.new, reviews: described_class.new) }
9
9
 
10
- it 'should use turbo-sprockets-rails3' do
11
- content = <<-EOF
12
- GEM
13
- remote: https://rubygems.org
14
- specs:
15
- rails (3.2.13)
16
- actionmailer (= 3.2.13)
17
- actionpack (= 3.2.13)
18
- activerecord (= 3.2.13)
19
- activeresource (= 3.2.13)
20
- activesupport (= 3.2.13)
21
- bundler (~> 1.0)
22
- railties (= 3.2.13)
10
+ it 'uses turbo-sprockets-rails3' do
11
+ content = <<~EOF
12
+ GEM
13
+ remote: https://rubygems.org
14
+ specs:
15
+ rails (3.2.13)
16
+ actionmailer (= 3.2.13)
17
+ actionpack (= 3.2.13)
18
+ activerecord (= 3.2.13)
19
+ activeresource (= 3.2.13)
20
+ activesupport (= 3.2.13)
21
+ bundler (~> 1.0)
22
+ railties (= 3.2.13)
23
23
  EOF
24
24
  runner.prepare('Gemfile.lock', content)
25
25
  content = <<-EOF
@@ -32,22 +32,22 @@ GEM
32
32
  expect(runner.errors[0].to_s).to eq('Capfile:2 - speed up assets precompile with turbo-sprockets-rails3')
33
33
  end
34
34
 
35
- it 'should not use turbo-sprockets-rails3 with turbo-sprockets-rails3 gem' do
36
- content = <<-EOF
37
- GEM
38
- remote: https://rubygems.org
39
- specs:
40
- rails (3.2.13)
41
- actionmailer (= 3.2.13)
42
- actionpack (= 3.2.13)
43
- activerecord (= 3.2.13)
44
- activeresource (= 3.2.13)
45
- activesupport (= 3.2.13)
46
- bundler (~> 1.0)
47
- railties (= 3.2.13)
48
- turbo-sprockets-rails3 (0.3.6)
49
- railties (> 3.2.8, < 4.0.0)
50
- sprockets (>= 2.0.0)
35
+ it 'does not use turbo-sprockets-rails3 with turbo-sprockets-rails3 gem' do
36
+ content = <<~EOF
37
+ GEM
38
+ remote: https://rubygems.org
39
+ specs:
40
+ rails (3.2.13)
41
+ actionmailer (= 3.2.13)
42
+ actionpack (= 3.2.13)
43
+ activerecord (= 3.2.13)
44
+ activeresource (= 3.2.13)
45
+ activesupport (= 3.2.13)
46
+ bundler (~> 1.0)
47
+ railties (= 3.2.13)
48
+ turbo-sprockets-rails3 (0.3.6)
49
+ railties (> 3.2.8, < 4.0.0)
50
+ sprockets (>= 2.0.0)
51
51
  EOF
52
52
  runner.prepare('Gemfile.lock', content)
53
53
  content = <<-EOF
@@ -59,7 +59,7 @@ GEM
59
59
  expect(runner.errors.size).to eq(0)
60
60
  end
61
61
 
62
- it 'should not use turbo-sprockets-rails3 without deploy/assets' do
62
+ it 'does not use turbo-sprockets-rails3 without deploy/assets' do
63
63
  content = <<-EOF
64
64
  load 'deploy' if respond_to?(:namespace)
65
65
  #load 'deploy/assets'
@@ -69,19 +69,19 @@ GEM
69
69
  expect(runner.errors.size).to eq(0)
70
70
  end
71
71
 
72
- it 'should not use turbo-sprockets-rails3 with rails4 gem' do
73
- content = <<-EOF
74
- GEM
75
- remote: https://rubygems.org
76
- specs:
77
- rails (4.0.0)
78
- actionmailer (= 4.0.0)
79
- actionpack (= 4.0.0)
80
- activerecord (= 4.0.0)
81
- activeresource (= 4.0.0)
82
- activesupport (= 4.0.0)
83
- bundler (~> 1.0)
84
- railties (= 3.2.13)
72
+ it 'does not use turbo-sprockets-rails3 with rails4 gem' do
73
+ content = <<~EOF
74
+ GEM
75
+ remote: https://rubygems.org
76
+ specs:
77
+ rails (4.0.0)
78
+ actionmailer (= 4.0.0)
79
+ actionpack (= 4.0.0)
80
+ activerecord (= 4.0.0)
81
+ activeresource (= 4.0.0)
82
+ activesupport (= 4.0.0)
83
+ bundler (~> 1.0)
84
+ railties (= 3.2.13)
85
85
  EOF
86
86
  runner.prepare('Gemfile.lock', content)
87
87
  content = <<-EOF
@@ -93,21 +93,23 @@ GEM
93
93
  expect(runner.errors.size).to eq(0)
94
94
  end
95
95
 
96
- it 'should not check ignored files' do
97
- runner = Core::Runner.new(prepares: Prepares::GemfilePrepare.new,
98
- reviews: UseTurboSprocketsRails3Review.new(ignored_files: /Capfile/))
99
- content = <<-EOF
100
- GEM
101
- remote: https://rubygems.org
102
- specs:
103
- rails (3.2.13)
104
- actionmailer (= 3.2.13)
105
- actionpack (= 3.2.13)
106
- activerecord (= 3.2.13)
107
- activeresource (= 3.2.13)
108
- activesupport (= 3.2.13)
109
- bundler (~> 1.0)
110
- railties (= 3.2.13)
96
+ it 'does not check ignored files' do
97
+ runner =
98
+ Core::Runner.new(
99
+ prepares: Prepares::GemfilePrepare.new, reviews: described_class.new(ignored_files: /Capfile/)
100
+ )
101
+ content = <<~EOF
102
+ GEM
103
+ remote: https://rubygems.org
104
+ specs:
105
+ rails (3.2.13)
106
+ actionmailer (= 3.2.13)
107
+ actionpack (= 3.2.13)
108
+ activerecord (= 3.2.13)
109
+ activeresource (= 3.2.13)
110
+ activesupport (= 3.2.13)
111
+ bundler (~> 1.0)
112
+ railties (= 3.2.13)
111
113
  EOF
112
114
  runner.prepare('Gemfile.lock', content)
113
115
  content = <<-EOF
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.2
4
+ version: 1.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2021-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.8
33
+ version: 0.5.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.4.8
40
+ version: 0.5.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: erubis
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.0'
89
+ version: '3.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.0'
96
+ version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: ruby-progressbar
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "<"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '11.0'
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "<"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '11.0'
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,7 @@ files:
205
205
  - ".travis.yml"
206
206
  - CHANGELOG.md
207
207
  - Gemfile
208
+ - Gemfile.lock
208
209
  - Guardfile
209
210
  - MIT_LICENSE
210
211
  - README.md
@@ -213,6 +214,7 @@ files:
213
214
  - bin/rails_best_practices
214
215
  - lib/rails_best_practices.rb
215
216
  - lib/rails_best_practices/analyzer.rb
217
+ - lib/rails_best_practices/cli.rb
216
218
  - lib/rails_best_practices/colorize.rb
217
219
  - lib/rails_best_practices/command.rb
218
220
  - lib/rails_best_practices/core.rb
@@ -237,6 +239,7 @@ files:
237
239
  - lib/rails_best_practices/lexicals/long_line_check.rb
238
240
  - lib/rails_best_practices/lexicals/remove_tab_check.rb
239
241
  - lib/rails_best_practices/lexicals/remove_trailing_whitespace_check.rb
242
+ - lib/rails_best_practices/option_parser.rb
240
243
  - lib/rails_best_practices/prepares.rb
241
244
  - lib/rails_best_practices/prepares/config_prepare.rb
242
245
  - lib/rails_best_practices/prepares/controller_prepare.rb
@@ -376,10 +379,6 @@ post_install_message: |
376
379
 
377
380
  http://rails-bestpractices.com
378
381
 
379
- Please also try our online service
380
-
381
- http://railsbp.com
382
-
383
382
  Enjoy!
384
383
 
385
384
  Richard Huang (flyerhzm@gmail.com)
@@ -400,9 +399,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
399
  - !ruby/object:Gem::Version
401
400
  version: 1.3.6
402
401
  requirements: []
403
- rubyforge_project:
404
- rubygems_version: 2.6.14
405
- signing_key:
402
+ rubygems_version: 3.1.6
403
+ signing_key:
406
404
  specification_version: 4
407
405
  summary: a code metric tool for rails codes.
408
406
  test_files: