rails_best_practices 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -68,7 +68,7 @@ LawOfDemeterCheck: { }
68
68
  UseObserverCheck: { }
69
69
  IsolateSeedDataCheck: { }
70
70
  AlwaysAddDbIndexCheck: { }
71
- UseFilterCheck: { }
71
+ UseBeforeFilterCheck: { }
72
72
  MoveCodeIntoControllerCheck: { }
73
73
  MoveCodeIntoHelperCheck: { }
74
74
  ReplaceInstanceVariableWithLocalVariableCheck: { }
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -2,10 +2,10 @@ require 'rails_best_practices/checks/check'
2
2
 
3
3
  module RailsBestPractices
4
4
  module Checks
5
- # Check a controller file to make sure to use filter to remove duplicate call in different action.
5
+ # Check a controller file to make sure to use before_filter to remove duplicate call in different action.
6
6
  #
7
- # Implementation: Check all methods' first call, if they are duplicate, then should use filter.
8
- class UseFilterCheck < Check
7
+ # Implementation: Check all methods' first call, if they are duplicate, then should use before_filter.
8
+ class UseBeforeFilterCheck < Check
9
9
 
10
10
  def interesting_nodes
11
11
  [:class]
@@ -19,7 +19,7 @@ module RailsBestPractices
19
19
  @methods = {}
20
20
  node.grep_nodes({:node_type => :defn}).each { |method_node| remember_method(method_node) }
21
21
  @methods.each do |first_call, method_names|
22
- add_error "use filter for #{first_call.to_ruby} in #{method_names.join(',')}" if method_names.size > 1
22
+ add_error "use before_filter for #{first_call.to_ruby} in #{method_names.join(',')}" if method_names.size > 1
23
23
  end
24
24
  end
25
25
 
@@ -15,7 +15,7 @@ require 'rails_best_practices/checks/law_of_demeter_check'
15
15
  require 'rails_best_practices/checks/use_observer_check'
16
16
  require 'rails_best_practices/checks/isolate_seed_data_check'
17
17
  require 'rails_best_practices/checks/always_add_db_index_check'
18
- require 'rails_best_practices/checks/use_filter_check'
18
+ require 'rails_best_practices/checks/use_before_filter_check'
19
19
  require 'rails_best_practices/checks/move_code_into_controller_check'
20
20
  require 'rails_best_practices/checks/move_code_into_helper_check'
21
21
  require 'rails_best_practices/checks/replace_instance_variable_with_local_variable_check'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails_best_practices}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Richard Huang"]
12
- s.date = %q{2009-11-17}
12
+ s.date = %q{2009-11-19}
13
13
  s.default_executable = %q{rails_best_practices}
14
14
  s.description = %q{check rails files according to ihower's presentation 'rails best practices'}
15
15
  s.email = %q{flyerhzm@gmail.com}
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
44
44
  "lib/rails_best_practices/checks/overuse_route_customizations_check.rb",
45
45
  "lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb",
46
46
  "lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb",
47
- "lib/rails_best_practices/checks/use_filter_check.rb",
47
+ "lib/rails_best_practices/checks/use_before_filter_check.rb",
48
48
  "lib/rails_best_practices/checks/use_model_association_check.rb",
49
49
  "lib/rails_best_practices/checks/use_model_callback_check.rb",
50
50
  "lib/rails_best_practices/checks/use_observer_check.rb",
@@ -74,7 +74,7 @@ Gem::Specification.new do |s|
74
74
  "spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb",
75
75
  "spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb",
76
76
  "spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb",
77
- "spec/rails_best_practices/checks/use_filter_check_spec.rb",
77
+ "spec/rails_best_practices/checks/use_before_filter_check_spec.rb",
78
78
  "spec/rails_best_practices/checks/use_model_association_check_spec.rb",
79
79
  "spec/rails_best_practices/checks/use_model_callback_check_spec.rb",
80
80
  "spec/rails_best_practices/checks/use_observer_check_spec.rb",
@@ -104,7 +104,7 @@ Gem::Specification.new do |s|
104
104
  "spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb",
105
105
  "spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb",
106
106
  "spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb",
107
- "spec/rails_best_practices/checks/use_filter_check_spec.rb",
107
+ "spec/rails_best_practices/checks/use_before_filter_check_spec.rb",
108
108
  "spec/rails_best_practices/checks/use_model_association_check_spec.rb",
109
109
  "spec/rails_best_practices/checks/use_model_callback_check_spec.rb",
110
110
  "spec/rails_best_practices/checks/use_observer_check_spec.rb",
@@ -15,7 +15,7 @@ LawOfDemeterCheck: { }
15
15
  UseObserverCheck: { }
16
16
  IsolateSeedDataCheck: { }
17
17
  AlwaysAddDbIndexCheck: { }
18
- UseFilterCheck: { }
18
+ UseBeforeFilterCheck: { }
19
19
  MoveCodeIntoControllerCheck: { }
20
20
  MoveCodeIntoHelperCheck: { }
21
21
  ReplaceInstanceVariableWithLocalVariableCheck: { }
@@ -1,8 +1,8 @@
1
1
  require File.join(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- describe RailsBestPractices::Checks::UseFilterCheck do
3
+ describe RailsBestPractices::Checks::UseBeforeFilterCheck do
4
4
  before(:each) do
5
- @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::UseFilterCheck.new)
5
+ @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::UseBeforeFilterCheck.new)
6
6
  end
7
7
 
8
8
  it "should use filter" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-17 00:00:00 +08:00
12
+ date: 2009-11-19 00:00:00 +08:00
13
13
  default_executable: rails_best_practices
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -67,7 +67,7 @@ files:
67
67
  - lib/rails_best_practices/checks/overuse_route_customizations_check.rb
68
68
  - lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb
69
69
  - lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb
70
- - lib/rails_best_practices/checks/use_filter_check.rb
70
+ - lib/rails_best_practices/checks/use_before_filter_check.rb
71
71
  - lib/rails_best_practices/checks/use_model_association_check.rb
72
72
  - lib/rails_best_practices/checks/use_model_callback_check.rb
73
73
  - lib/rails_best_practices/checks/use_observer_check.rb
@@ -97,7 +97,7 @@ files:
97
97
  - spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb
98
98
  - spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb
99
99
  - spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb
100
- - spec/rails_best_practices/checks/use_filter_check_spec.rb
100
+ - spec/rails_best_practices/checks/use_before_filter_check_spec.rb
101
101
  - spec/rails_best_practices/checks/use_model_association_check_spec.rb
102
102
  - spec/rails_best_practices/checks/use_model_callback_check_spec.rb
103
103
  - spec/rails_best_practices/checks/use_observer_check_spec.rb
@@ -149,7 +149,7 @@ test_files:
149
149
  - spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb
150
150
  - spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb
151
151
  - spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb
152
- - spec/rails_best_practices/checks/use_filter_check_spec.rb
152
+ - spec/rails_best_practices/checks/use_before_filter_check_spec.rb
153
153
  - spec/rails_best_practices/checks/use_model_association_check_spec.rb
154
154
  - spec/rails_best_practices/checks/use_model_callback_check_spec.rb
155
155
  - spec/rails_best_practices/checks/use_observer_check_spec.rb