rails_best_practices 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -1
- data/.travis.yml +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +45 -0
- data/README.md +2 -0
- data/assets/result.html.erb +78 -0
- data/lib/rails_best_practices.rb +5 -4
- data/lib/rails_best_practices/core.rb +2 -0
- data/lib/rails_best_practices/core/check.rb +27 -1
- data/lib/rails_best_practices/core/controllers.rb +7 -0
- data/lib/rails_best_practices/core/methods.rb +26 -0
- data/lib/rails_best_practices/core/runner.rb +3 -1
- data/lib/rails_best_practices/core_ext/sexp.rb +33 -8
- data/lib/rails_best_practices/prepares.rb +13 -0
- data/lib/rails_best_practices/prepares/controller_prepare.rb +74 -0
- data/lib/rails_best_practices/prepares/mailer_prepare.rb +3 -2
- data/lib/rails_best_practices/prepares/model_prepare.rb +12 -10
- data/lib/rails_best_practices/reviews.rb +1 -0
- data/lib/rails_best_practices/reviews/needless_deep_nesting_review.rb +1 -1
- data/lib/rails_best_practices/reviews/not_use_default_route_review.rb +1 -1
- data/lib/rails_best_practices/reviews/overuse_route_customizations_review.rb +1 -1
- data/lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb +149 -0
- data/lib/rails_best_practices/version.rb +1 -1
- data/rails_best_practices.gemspec +3 -3
- data/rails_best_practices.yml +1 -0
- data/spec/rails_best_practices/core/controllers_spec.rb +5 -0
- data/spec/rails_best_practices/core/methods_spec.rb +22 -0
- data/spec/rails_best_practices/core_ext/sexp_spec.rb +28 -1
- data/spec/rails_best_practices/prepares/controller_prepare_spec.rb +92 -0
- data/spec/rails_best_practices/prepares/model_prepare_spec.rb +22 -0
- data/spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb +4 -4
- data/spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb +334 -0
- data/spec/spec_helper.rb +6 -0
- metadata +27 -13
- data/assets/result.html.haml +0 -63
@@ -34,6 +34,28 @@ describe RailsBestPractices::Prepares::ModelPrepare do
|
|
34
34
|
lambda { runner.prepare('app/models/event_subscription.rb', content) }.should_not raise_error
|
35
35
|
end
|
36
36
|
|
37
|
+
it "class_name with modules ::" do
|
38
|
+
content =<<-EOF
|
39
|
+
class Blog::Post < ActiveRecord::Base
|
40
|
+
end
|
41
|
+
EOF
|
42
|
+
runner.prepare("app/models/admin/post.rb", content)
|
43
|
+
models = RailsBestPractices::Prepares.models
|
44
|
+
models.should == ["Blog::Post"]
|
45
|
+
end
|
46
|
+
|
47
|
+
it "class_name with modules" do
|
48
|
+
content =<<-EOF
|
49
|
+
module Blog
|
50
|
+
class Post < ActiveRecord::Base
|
51
|
+
end
|
52
|
+
end
|
53
|
+
EOF
|
54
|
+
runner.prepare("app/models/admin/post.rb", content)
|
55
|
+
models = RailsBestPractices::Prepares.models
|
56
|
+
models.should == ["Blog::Post"]
|
57
|
+
end
|
58
|
+
|
37
59
|
context "class_name" do
|
38
60
|
it "should parse belongs_to" do
|
39
61
|
content =<<-EOF
|
@@ -99,7 +99,7 @@ describe RailsBestPractices::Reviews::OveruseRouteCustomizationsReview do
|
|
99
99
|
describe "rails3" do
|
100
100
|
it "should overuse route customizations" do
|
101
101
|
content = <<-EOF
|
102
|
-
RailsBestpracticesCom::Application.routes.draw do
|
102
|
+
RailsBestpracticesCom::Application.routes.draw do
|
103
103
|
resources :posts do
|
104
104
|
member do
|
105
105
|
post :create_comment
|
@@ -120,7 +120,7 @@ describe RailsBestPractices::Reviews::OveruseRouteCustomizationsReview do
|
|
120
120
|
|
121
121
|
it "should overuse route customizations another way" do
|
122
122
|
content = <<-EOF
|
123
|
-
RailsBestpracticesCom::Application.routes.draw do
|
123
|
+
RailsBestpracticesCom::Application.routes.draw do
|
124
124
|
resources :posts do
|
125
125
|
post :create_comment, :on => :member
|
126
126
|
update :update_comment, :on => :member
|
@@ -136,7 +136,7 @@ describe RailsBestPractices::Reviews::OveruseRouteCustomizationsReview do
|
|
136
136
|
|
137
137
|
it "should not overuse route customizations without customization" do
|
138
138
|
content = <<-EOF
|
139
|
-
RailsBestpracticesCom::Application.routes.draw do
|
139
|
+
RailsBestpracticesCom::Application.routes.draw do
|
140
140
|
resources :posts
|
141
141
|
end
|
142
142
|
EOF
|
@@ -146,7 +146,7 @@ describe RailsBestPractices::Reviews::OveruseRouteCustomizationsReview do
|
|
146
146
|
|
147
147
|
it "should not overuse route customizations when customize route is only one" do
|
148
148
|
content = <<-EOF
|
149
|
-
RailsBestpracticesCom::Application.routes.draw do
|
149
|
+
RailsBestpracticesCom::Application.routes.draw do
|
150
150
|
resources :posts do
|
151
151
|
member do
|
152
152
|
post :vote
|
@@ -0,0 +1,334 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsBestPractices::Reviews::RestrictAutoGeneratedRoutesReview do
|
4
|
+
let(:runner) {
|
5
|
+
RailsBestPractices::Core::Runner.new(
|
6
|
+
:prepares => RailsBestPractices::Prepares::ControllerPrepare.new,
|
7
|
+
:reviews => RailsBestPractices::Reviews::RestrictAutoGeneratedRoutesReview.new
|
8
|
+
)
|
9
|
+
}
|
10
|
+
|
11
|
+
describe "resources" do
|
12
|
+
before :each do
|
13
|
+
content =<<-EOF
|
14
|
+
class PostsController < ApplicationController
|
15
|
+
def show; end
|
16
|
+
def new; end
|
17
|
+
def create; end
|
18
|
+
def edit; end
|
19
|
+
def update; end
|
20
|
+
def destroy; end
|
21
|
+
end
|
22
|
+
EOF
|
23
|
+
runner.prepare('app/controllers/posts_controller.rb', content)
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "rails2" do
|
27
|
+
it "should restrict auto-generated routes" do
|
28
|
+
content =<<-EOF
|
29
|
+
ActionController::Routing::Routes.draw do |map|
|
30
|
+
map.resources :posts
|
31
|
+
end
|
32
|
+
EOF
|
33
|
+
runner.review('config/routes.rb', content)
|
34
|
+
runner.should have(1).errors
|
35
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should not restrict auto-generated routes with only" do
|
39
|
+
content =<<-EOF
|
40
|
+
ActionController::Routing::Routes.draw do |map|
|
41
|
+
map.resources :posts, :only => [:show, :new, :create, :edit, :update, :destroy]
|
42
|
+
end
|
43
|
+
EOF
|
44
|
+
runner.review('config/routes.rb', content)
|
45
|
+
runner.should have(0).errors
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should not restrict auto-generated routes with except" do
|
49
|
+
content =<<-EOF
|
50
|
+
ActionController::Routing::Routes.draw do |map|
|
51
|
+
map.resources :posts, :except => :index
|
52
|
+
end
|
53
|
+
EOF
|
54
|
+
runner.review('config/routes.rb', content)
|
55
|
+
runner.should have(0).errors
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "specify a controller" do
|
59
|
+
it "should restrict auto-generated routes" do
|
60
|
+
content =<<-EOF
|
61
|
+
ActionController::Routing::Routes.draw do |map|
|
62
|
+
map.resources :articles, :controller => "posts"
|
63
|
+
end
|
64
|
+
EOF
|
65
|
+
runner.review('config/routes.rb', content)
|
66
|
+
runner.should have(1).errors
|
67
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "nested routes" do
|
72
|
+
before :each do
|
73
|
+
content =<<-EOF
|
74
|
+
class CommentsController < ApplicationController
|
75
|
+
def index; end
|
76
|
+
def show; end
|
77
|
+
def new; end
|
78
|
+
def create; end
|
79
|
+
def edit; end
|
80
|
+
def update; end
|
81
|
+
def destroy; end
|
82
|
+
end
|
83
|
+
EOF
|
84
|
+
runner.prepare('app/controllers/comments_controller.rb', content)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should restrict auto-generated routes" do
|
88
|
+
content =<<-EOF
|
89
|
+
ActionController::Routing::Routes.draw do |map|
|
90
|
+
map.resources :posts do |post|
|
91
|
+
post.resources :comments
|
92
|
+
end
|
93
|
+
end
|
94
|
+
EOF
|
95
|
+
runner.review('config/routes.rb', content)
|
96
|
+
runner.should have(1).errors
|
97
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should not restrict auto-generated routes with only" do
|
101
|
+
content =<<-EOF
|
102
|
+
ActionController::Routing::Routes.draw do |map|
|
103
|
+
map.resources :posts, :only => [:show, :new, :create, :edit, :update, :destroy] do |post|
|
104
|
+
post.resources :comments
|
105
|
+
end
|
106
|
+
end
|
107
|
+
EOF
|
108
|
+
runner.review('config/routes.rb', content)
|
109
|
+
runner.should have(0).errors
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should not restrict auto-generated routes with except" do
|
113
|
+
content =<<-EOF
|
114
|
+
ActionController::Routing::Routes.draw do |map|
|
115
|
+
map.resources :posts, :except => :index do |post|
|
116
|
+
post.resources :comments
|
117
|
+
end
|
118
|
+
end
|
119
|
+
EOF
|
120
|
+
runner.review('config/routes.rb', content)
|
121
|
+
runner.should have(0).errors
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "rails3" do
|
127
|
+
it "should restrict auto-generated routes" do
|
128
|
+
content =<<-EOF
|
129
|
+
RailsBestPracticesCom::Application.routes.draw do
|
130
|
+
resources :posts
|
131
|
+
end
|
132
|
+
EOF
|
133
|
+
runner.review('config/routes.rb', content)
|
134
|
+
runner.should have(1).errors
|
135
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should not restrict auto-generated routes with only" do
|
139
|
+
content =<<-EOF
|
140
|
+
RailsBestPracticesCom::Application.routes.draw do
|
141
|
+
resources :posts, :only => [:show, :new, :create, :edit, :update, :destroy]
|
142
|
+
end
|
143
|
+
EOF
|
144
|
+
runner.review('config/routes.rb', content)
|
145
|
+
runner.should have(0).errors
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should not restrict auto-generated routes with except" do
|
149
|
+
content =<<-EOF
|
150
|
+
RailsBestPracticesCom::Application.routes.draw do
|
151
|
+
resources :posts, :except => :index
|
152
|
+
end
|
153
|
+
EOF
|
154
|
+
runner.review('config/routes.rb', content)
|
155
|
+
runner.should have(0).errors
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "specify a controller" do
|
159
|
+
it "should restrict auto-generated routes" do
|
160
|
+
content =<<-EOF
|
161
|
+
RailsBestPracticesCom::Application.routes.draw do
|
162
|
+
resources :articles, :controller => "posts"
|
163
|
+
end
|
164
|
+
EOF
|
165
|
+
runner.review('config/routes.rb', content)
|
166
|
+
runner.should have(1).errors
|
167
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "namespace" do
|
172
|
+
it "should restrict auto-generated routes" do
|
173
|
+
content =<<-EOF
|
174
|
+
class Admin::CommentsController < ApplicationController
|
175
|
+
def show; end
|
176
|
+
def new; end
|
177
|
+
def create; end
|
178
|
+
def edit; end
|
179
|
+
def update; end
|
180
|
+
def destroy; end
|
181
|
+
end
|
182
|
+
EOF
|
183
|
+
runner.prepare('app/controllers/admin/comments_controller.rb', content)
|
184
|
+
|
185
|
+
content =<<-EOF
|
186
|
+
RailsBestPracticesCom::Application.routes.draw do
|
187
|
+
namespace :admin do
|
188
|
+
resources :comments
|
189
|
+
end
|
190
|
+
end
|
191
|
+
EOF
|
192
|
+
runner.review('config/routes.rb', content)
|
193
|
+
runner.should have(1).errors
|
194
|
+
runner.errors[0].to_s.should == "config/routes.rb:3 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe "nested routes" do
|
199
|
+
before :each do
|
200
|
+
content =<<-EOF
|
201
|
+
class CommentsController < ApplicationController
|
202
|
+
def index; end
|
203
|
+
def show; end
|
204
|
+
def new; end
|
205
|
+
def create; end
|
206
|
+
def edit; end
|
207
|
+
def update; end
|
208
|
+
def destroy; end
|
209
|
+
end
|
210
|
+
EOF
|
211
|
+
runner.prepare('app/controllers/comments_controller.rb', content)
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should restrict auto-generated routes" do
|
215
|
+
content =<<-EOF
|
216
|
+
RailsBestPracticesCom::Application.routes.draw do
|
217
|
+
resources :posts do
|
218
|
+
resources :comments
|
219
|
+
end
|
220
|
+
end
|
221
|
+
EOF
|
222
|
+
runner.review('config/routes.rb', content)
|
223
|
+
runner.should have(1).errors
|
224
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update, :destroy])"
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should not restrict auto-generated routes with only" do
|
228
|
+
content =<<-EOF
|
229
|
+
RailsBestPracticesCom::Application.routes.draw do
|
230
|
+
resources :posts, :only => [:show, :new, :create, :edit, :update, :destroy] do
|
231
|
+
resources :comments
|
232
|
+
end
|
233
|
+
end
|
234
|
+
EOF
|
235
|
+
runner.review('config/routes.rb', content)
|
236
|
+
runner.should have(0).errors
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should not restrict auto-generated routes with except" do
|
240
|
+
content =<<-EOF
|
241
|
+
RailsBestPracticesCom::Application.routes.draw do
|
242
|
+
resources :posts, :except => :index do
|
243
|
+
resources :comments
|
244
|
+
end
|
245
|
+
end
|
246
|
+
EOF
|
247
|
+
runner.review('config/routes.rb', content)
|
248
|
+
runner.should have(0).errors
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
describe "resource" do
|
255
|
+
before :each do
|
256
|
+
content =<<-EOF
|
257
|
+
class AccountsController < ApplicationController
|
258
|
+
def show; end
|
259
|
+
def new; end
|
260
|
+
def create; end
|
261
|
+
def edit; end
|
262
|
+
def update; end
|
263
|
+
end
|
264
|
+
EOF
|
265
|
+
runner.prepare('app/controllers/accounts_controller.rb', content)
|
266
|
+
end
|
267
|
+
|
268
|
+
describe "rails2" do
|
269
|
+
it "should restrict auto-generated routes" do
|
270
|
+
content =<<-EOF
|
271
|
+
ActionController::Routing::Routes.draw do |map|
|
272
|
+
map.resource :account
|
273
|
+
end
|
274
|
+
EOF
|
275
|
+
runner.review('config/routes.rb', content)
|
276
|
+
runner.should have(1).errors
|
277
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update])"
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should not restrict auto-generated routes with only" do
|
281
|
+
content =<<-EOF
|
282
|
+
ActionController::Routing::Routes.draw do |map|
|
283
|
+
map.resource :account, :only => [:show, :new, :create, :edit, :update]
|
284
|
+
end
|
285
|
+
EOF
|
286
|
+
runner.review('config/routes.rb', content)
|
287
|
+
runner.should have(0).errors
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should not restrict auto-generated routes with except" do
|
291
|
+
content =<<-EOF
|
292
|
+
ActionController::Routing::Routes.draw do |map|
|
293
|
+
map.resource :account, :except => :destroy
|
294
|
+
end
|
295
|
+
EOF
|
296
|
+
runner.review('config/routes.rb', content)
|
297
|
+
runner.should have(0).errors
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
describe "rails3" do
|
302
|
+
it "should restrict auto-generated routes" do
|
303
|
+
content =<<-EOF
|
304
|
+
ActionController::Routing::Routes.draw do |map|
|
305
|
+
map.resource :account
|
306
|
+
end
|
307
|
+
EOF
|
308
|
+
runner.review('config/routes.rb', content)
|
309
|
+
runner.should have(1).errors
|
310
|
+
runner.errors[0].to_s.should == "config/routes.rb:2 - restrict auto-generated routes (:only => [:show, :new, :create, :edit, :update])"
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should not restrict auto-generated routes with only" do
|
314
|
+
content =<<-EOF
|
315
|
+
ActionController::Routing::Routes.draw do |map|
|
316
|
+
map.resource :account, :only => [:show, :new, :create, :edit, :update]
|
317
|
+
end
|
318
|
+
EOF
|
319
|
+
runner.review('config/routes.rb', content)
|
320
|
+
runner.should have(0).errors
|
321
|
+
end
|
322
|
+
|
323
|
+
it "should not restrict auto-generated routes with except" do
|
324
|
+
content =<<-EOF
|
325
|
+
ActionController::Routing::Routes.draw do |map|
|
326
|
+
map.resource :account, :except => :destroy
|
327
|
+
end
|
328
|
+
EOF
|
329
|
+
runner.review('config/routes.rb', content)
|
330
|
+
runner.should have(0).errors
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,6 +4,12 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
|
4
4
|
require 'rspec/expectations'
|
5
5
|
require 'rails_best_practices'
|
6
6
|
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.after do
|
9
|
+
RailsBestPractices::Prepares.clear
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
def parse_content(content)
|
8
14
|
Sexp.from_array(Ripper::SexpBuilder.new(content).parse)[1]
|
9
15
|
end
|
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.0
|
5
|
+
version: 1.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richard Huang
|
@@ -10,11 +10,11 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-06 00:00:00 +08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: sexp_processor
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: progressbar
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: *id004
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: i18n
|
62
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: *id005
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: activesupport
|
73
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
@@ -80,18 +80,18 @@ dependencies:
|
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: rake
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: "0"
|
90
|
-
type: :
|
90
|
+
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: *id007
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: rspec
|
95
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
@@ -102,7 +102,7 @@ dependencies:
|
|
102
102
|
prerelease: false
|
103
103
|
version_requirements: *id008
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: watchr
|
106
106
|
requirement: &id009 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
@@ -113,7 +113,7 @@ dependencies:
|
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: *id009
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
|
-
name:
|
116
|
+
name: haml
|
117
117
|
requirement: &id010 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
@@ -148,13 +148,15 @@ files:
|
|
148
148
|
- .gitignore
|
149
149
|
- .rspec.example
|
150
150
|
- .rvmrc.example
|
151
|
+
- .travis.yml
|
151
152
|
- .watchr
|
152
153
|
- .watchr.example
|
153
154
|
- Gemfile
|
155
|
+
- Gemfile.lock
|
154
156
|
- MIT_LICENSE
|
155
157
|
- README.md
|
156
158
|
- Rakefile
|
157
|
-
- assets/result.html.
|
159
|
+
- assets/result.html.erb
|
158
160
|
- autotest/discover.rb
|
159
161
|
- bin/rails_best_practices
|
160
162
|
- install_supported_rubies.sh
|
@@ -163,8 +165,10 @@ files:
|
|
163
165
|
- lib/rails_best_practices/core.rb
|
164
166
|
- lib/rails_best_practices/core/check.rb
|
165
167
|
- lib/rails_best_practices/core/checking_visitor.rb
|
168
|
+
- lib/rails_best_practices/core/controllers.rb
|
166
169
|
- lib/rails_best_practices/core/error.rb
|
167
170
|
- lib/rails_best_practices/core/mailers.rb
|
171
|
+
- lib/rails_best_practices/core/methods.rb
|
168
172
|
- lib/rails_best_practices/core/model_associations.rb
|
169
173
|
- lib/rails_best_practices/core/model_attributes.rb
|
170
174
|
- lib/rails_best_practices/core/models.rb
|
@@ -176,6 +180,7 @@ files:
|
|
176
180
|
- lib/rails_best_practices/lexicals/remove_tab_check.rb
|
177
181
|
- lib/rails_best_practices/lexicals/remove_trailing_whitespace_check.rb
|
178
182
|
- lib/rails_best_practices/prepares.rb
|
183
|
+
- lib/rails_best_practices/prepares/controller_prepare.rb
|
179
184
|
- lib/rails_best_practices/prepares/mailer_prepare.rb
|
180
185
|
- lib/rails_best_practices/prepares/model_prepare.rb
|
181
186
|
- lib/rails_best_practices/prepares/schema_prepare.rb
|
@@ -197,6 +202,7 @@ files:
|
|
197
202
|
- lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
|
198
203
|
- lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb
|
199
204
|
- lib/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review.rb
|
205
|
+
- lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb
|
200
206
|
- lib/rails_best_practices/reviews/review.rb
|
201
207
|
- lib/rails_best_practices/reviews/simplify_render_in_controllers_review.rb
|
202
208
|
- lib/rails_best_practices/reviews/simplify_render_in_views_review.rb
|
@@ -213,7 +219,9 @@ files:
|
|
213
219
|
- rake_rubies.sh
|
214
220
|
- spec/rails_best_practices/core/check_spec.rb
|
215
221
|
- spec/rails_best_practices/core/checking_visitor_spec.rb
|
222
|
+
- spec/rails_best_practices/core/controllers_spec.rb
|
216
223
|
- spec/rails_best_practices/core/error_spec.rb
|
224
|
+
- spec/rails_best_practices/core/methods_spec.rb
|
217
225
|
- spec/rails_best_practices/core/model_associations_spec.rb
|
218
226
|
- spec/rails_best_practices/core/model_attributes_spec.rb
|
219
227
|
- spec/rails_best_practices/core/models_spec.rb
|
@@ -222,6 +230,7 @@ files:
|
|
222
230
|
- spec/rails_best_practices/core_ext/sexp_spec.rb
|
223
231
|
- spec/rails_best_practices/lexicals/remove_tab_check_spec.rb
|
224
232
|
- spec/rails_best_practices/lexicals/remove_trailing_whitespace_check_spec.rb
|
233
|
+
- spec/rails_best_practices/prepares/controller_prepare_spec.rb
|
225
234
|
- spec/rails_best_practices/prepares/mailer_prepare_spec.rb
|
226
235
|
- spec/rails_best_practices/prepares/model_prepare_spec.rb
|
227
236
|
- spec/rails_best_practices/prepares/schema_prepare_spec.rb
|
@@ -242,6 +251,7 @@ files:
|
|
242
251
|
- spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
|
243
252
|
- spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
|
244
253
|
- spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
|
254
|
+
- spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb
|
245
255
|
- spec/rails_best_practices/reviews/simplify_render_in_controllers_review_spec.rb
|
246
256
|
- spec/rails_best_practices/reviews/simplify_render_in_views_review_spec.rb
|
247
257
|
- spec/rails_best_practices/reviews/use_before_filter_review_spec.rb
|
@@ -281,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
281
291
|
requirements:
|
282
292
|
- - ">="
|
283
293
|
- !ruby/object:Gem::Version
|
284
|
-
hash: -
|
294
|
+
hash: -4549595437881865702
|
285
295
|
segments:
|
286
296
|
- 0
|
287
297
|
version: "0"
|
@@ -301,7 +311,9 @@ summary: a code metric tool for rails codes.
|
|
301
311
|
test_files:
|
302
312
|
- spec/rails_best_practices/core/check_spec.rb
|
303
313
|
- spec/rails_best_practices/core/checking_visitor_spec.rb
|
314
|
+
- spec/rails_best_practices/core/controllers_spec.rb
|
304
315
|
- spec/rails_best_practices/core/error_spec.rb
|
316
|
+
- spec/rails_best_practices/core/methods_spec.rb
|
305
317
|
- spec/rails_best_practices/core/model_associations_spec.rb
|
306
318
|
- spec/rails_best_practices/core/model_attributes_spec.rb
|
307
319
|
- spec/rails_best_practices/core/models_spec.rb
|
@@ -310,6 +322,7 @@ test_files:
|
|
310
322
|
- spec/rails_best_practices/core_ext/sexp_spec.rb
|
311
323
|
- spec/rails_best_practices/lexicals/remove_tab_check_spec.rb
|
312
324
|
- spec/rails_best_practices/lexicals/remove_trailing_whitespace_check_spec.rb
|
325
|
+
- spec/rails_best_practices/prepares/controller_prepare_spec.rb
|
313
326
|
- spec/rails_best_practices/prepares/mailer_prepare_spec.rb
|
314
327
|
- spec/rails_best_practices/prepares/model_prepare_spec.rb
|
315
328
|
- spec/rails_best_practices/prepares/schema_prepare_spec.rb
|
@@ -330,6 +343,7 @@ test_files:
|
|
330
343
|
- spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
|
331
344
|
- spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb
|
332
345
|
- spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb
|
346
|
+
- spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb
|
333
347
|
- spec/rails_best_practices/reviews/simplify_render_in_controllers_review_spec.rb
|
334
348
|
- spec/rails_best_practices/reviews/simplify_render_in_views_review_spec.rb
|
335
349
|
- spec/rails_best_practices/reviews/use_before_filter_review_spec.rb
|