rails_best_practices 1.18.1 → 1.19.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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +4 -1
  4. data/Gemfile +3 -3
  5. data/README.md +1 -1
  6. data/Rakefile +1 -4
  7. data/lib/rails_best_practices/analyzer.rb +3 -3
  8. data/lib/rails_best_practices/core/routes.rb +1 -1
  9. data/lib/rails_best_practices/lexicals/remove_tab_check.rb +2 -2
  10. data/lib/rails_best_practices/lexicals/remove_trailing_whitespace_check.rb +2 -2
  11. data/lib/rails_best_practices/prepares/route_prepare.rb +5 -0
  12. data/lib/rails_best_practices/reviews/add_model_virtual_attribute_review.rb +2 -2
  13. data/lib/rails_best_practices/reviews/always_add_db_index_review.rb +2 -2
  14. data/lib/rails_best_practices/reviews/check_save_return_value_review.rb +2 -2
  15. data/lib/rails_best_practices/reviews/default_scope_is_evil_review.rb +2 -2
  16. data/lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb +2 -2
  17. data/lib/rails_best_practices/reviews/isolate_seed_data_review.rb +2 -2
  18. data/lib/rails_best_practices/reviews/keep_finders_on_their_own_model_review.rb +2 -2
  19. data/lib/rails_best_practices/reviews/law_of_demeter_review.rb +2 -2
  20. data/lib/rails_best_practices/reviews/move_code_into_controller_review.rb +2 -2
  21. data/lib/rails_best_practices/reviews/move_code_into_helper_review.rb +2 -2
  22. data/lib/rails_best_practices/reviews/move_code_into_model_review.rb +2 -2
  23. data/lib/rails_best_practices/reviews/move_finder_to_named_scope_review.rb +2 -2
  24. data/lib/rails_best_practices/reviews/move_model_logic_into_model_review.rb +2 -2
  25. data/lib/rails_best_practices/reviews/needless_deep_nesting_review.rb +2 -2
  26. data/lib/rails_best_practices/reviews/not_rescue_exception_review.rb +2 -2
  27. data/lib/rails_best_practices/reviews/not_use_default_route_review.rb +3 -12
  28. data/lib/rails_best_practices/reviews/not_use_time_ago_in_words_review.rb +2 -2
  29. data/lib/rails_best_practices/reviews/overuse_route_customizations_review.rb +2 -47
  30. data/lib/rails_best_practices/reviews/protect_mass_assignment_review.rb +2 -2
  31. data/lib/rails_best_practices/reviews/remove_empty_helpers_review.rb +2 -2
  32. data/lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb +2 -2
  33. data/lib/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review.rb +2 -2
  34. data/lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb +15 -6
  35. data/lib/rails_best_practices/reviews/simplify_render_in_controllers_review.rb +2 -2
  36. data/lib/rails_best_practices/reviews/simplify_render_in_views_review.rb +2 -2
  37. data/lib/rails_best_practices/reviews/use_before_filter_review.rb +2 -2
  38. data/lib/rails_best_practices/reviews/use_model_association_review.rb +2 -2
  39. data/lib/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review.rb +3 -18
  40. data/lib/rails_best_practices/reviews/use_observer_review.rb +2 -13
  41. data/lib/rails_best_practices/reviews/use_query_attribute_review.rb +2 -2
  42. data/lib/rails_best_practices/reviews/use_say_with_time_in_migrations_review.rb +2 -2
  43. data/lib/rails_best_practices/reviews/use_scope_access_review.rb +2 -2
  44. data/lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb +2 -2
  45. data/lib/rails_best_practices/version.rb +1 -1
  46. data/rails_best_practices.gemspec +2 -2
  47. data/spec/rails_best_practices/analyzer_spec.rb +1 -1
  48. data/spec/rails_best_practices/prepares/route_prepare_spec.rb +338 -586
  49. data/spec/rails_best_practices/reviews/needless_deep_nesting_review_spec.rb +59 -140
  50. data/spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb +26 -69
  51. data/spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb +44 -153
  52. data/spec/rails_best_practices/reviews/protect_mass_assignment_review_spec.rb +2 -2
  53. data/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +21 -0
  54. data/spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb +160 -272
  55. data/spec/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review_spec.rb +76 -209
  56. data/spec/rails_best_practices/reviews/use_observer_review_spec.rb +43 -110
  57. data/spec/rails_best_practices/reviews/use_turbo_sprockets_rails3_review_spec.rb +4 -4
  58. metadata +5 -23
  59. data/.rubocop.yml +0 -1
  60. data/.rubocop_todo.yml +0 -382
  61. data/install_supported_rubies.sh +0 -10
  62. data/rake_rubies.sh +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b28f335fee20969fe2276bdd1167772552262162
4
- data.tar.gz: aff5bdb928fbae84063f42e0b79bc72c2766d11c
3
+ metadata.gz: a21a8ed1b2556fb543a2e0198c20cc0e1717408c
4
+ data.tar.gz: 5590f1f768fbe89156474a9b6c6e2d3876f0ab7b
5
5
  SHA512:
6
- metadata.gz: 9650af54486b7bf655ed79287e43e70c43314d2353a3a68680ff9a17a7c4548056b48b67e3e0ce7d4d9af76f5d087138d6119e6026c816f70e566e63b38883ca
7
- data.tar.gz: ea4bb8533886d4bd11e25af6eb19c2a354aae861ccf7f9fba22636b0d78da6d97a15626984c9d7ec72b48440107a1766790845c4df8964621e9cbf7fb5811695
6
+ metadata.gz: 9ade021d411ca4b45c36628ba5a9bed899b0ffcde8b5ca7289171c08aa2493b5c9a04cad2af7758cb50a0f8fdae1f9b5ec4d40396a97145a33d7b32c7630ea82
7
+ data.tar.gz: 4ac6bfab4420bac0d7476b2694123fa43d21eb5936a85bdea86f0cb3a17e86d308efac99927aa5325d467bc4bb4b1d6e4c41b7d67405198491add9ee63bf60dc
@@ -2,4 +2,4 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.3.0
5
+ - 2.3.3
@@ -1,8 +1,11 @@
1
1
  # Next Release
2
2
 
3
- ## 1.18.1
3
+ ## 1.19.0 (2017-07-26)
4
4
 
5
+ * RestrictAutoGeneratedRoutesCheck is compatibale with rails api_only
6
+ * Remove Rails 2 support
5
7
  * Remove haml ugly option
8
+ * Fix RemoveUnusedMethodsInControllers warning at inline routes
6
9
 
7
10
  ## 1.18.0 (2017-03-01)
8
11
 
data/Gemfile CHANGED
@@ -4,10 +4,10 @@ gemspec
4
4
  gem 'coveralls', require: false
5
5
 
6
6
  if RUBY_PLATFORM =~ /darwin/i
7
- gem 'rb-fsevent'
8
7
  gem 'growl'
8
+ gem 'rb-fsevent'
9
9
  end
10
- gem 'pry'
11
10
  gem 'guard'
12
- gem 'rspec', '~> 2.14.0'
13
11
  gem 'guard-rspec'
12
+ gem 'pry'
13
+ gem 'rspec', '~> 2.14.0'
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # rails_best_practices
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rails_best_practices.svg)](http://badge.fury.io/rb/rails_best_practices)
4
- [![Build Status](https://secure.travis-ci.org/railsbp/rails_best_practices.svg)](http://travis-ci.org/railsbp/rails_best_practices)
4
+ [![Build Status](https://secure.travis-ci.org/flyerhzm/rails_best_practices.svg)](http://travis-ci.org/flyerhzm/rails_best_practices)
5
5
  [![Coverage Status](https://coveralls.io/repos/railsbp/rails_best_practices/badge.svg?branch=master)](https://coveralls.io/r/railsbp/rails_best_practices)
6
6
 
7
7
  [![Coderwall Endorse](http://api.coderwall.com/flyerhzm/endorsecount.png)](http://coderwall.com/flyerhzm)
data/Rakefile CHANGED
@@ -6,7 +6,6 @@ Bundler.setup
6
6
  require "rake"
7
7
  require "rspec"
8
8
  require "rspec/core/rake_task"
9
- require 'rubocop/rake_task'
10
9
 
11
10
  $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
12
11
  require "rails_best_practices/version"
@@ -15,7 +14,5 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
15
14
  spec.pattern = "spec/**/*_spec.rb"
16
15
  end
17
16
 
18
- RuboCop::RakeTask.new
19
-
20
- task :default => [:spec, :rubocop]
17
+ task :default => :spec
21
18
  task :test => :spec
@@ -4,7 +4,7 @@ require 'json'
4
4
  require 'ruby-progressbar'
5
5
 
6
6
  module RailsBestPractices
7
- # RailsBestPractices Analyzer helps you to analyze your rails code, according to best practices on http://rails-bestpractices.
7
+ # RailsBestPractices Analyzer helps you to analyze your rails code, according to best practices on https://rails-bestpractices.
8
8
  # if it finds any violatioins to best practices, it will give you some readable suggestions.
9
9
  #
10
10
  # The analysis process is partitioned into two parts,
@@ -180,7 +180,7 @@ module RailsBestPractices
180
180
  # output errors on terminal.
181
181
  def output_terminal_errors
182
182
  errors.each { |error| plain_output(error.to_s, 'red') }
183
- plain_output("\nPlease go to http://rails-bestpractices.com to see more useful Rails Best Practices.", 'green')
183
+ plain_output("\nPlease go to https://rails-bestpractices.com to see more useful Rails Best Practices.", 'green')
184
184
  if errors.empty?
185
185
  plain_output("\nNo warning found. Cool!", 'green')
186
186
  else
@@ -226,7 +226,7 @@ module RailsBestPractices
226
226
 
227
227
  if @options["with-github"]
228
228
  last_commit_id = @options["last-commit-id"] ? @options["last-commit-id"] : `cd #{@runner.class.base_path} && git rev-parse HEAD`.chomp
229
- unless @options["github-name"].start_with?('http')
229
+ unless @options["github-name"].start_with?('https')
230
230
  @options["github-name"] = GITHUB_URL + @options["github-name"]
231
231
  end
232
232
  end
@@ -22,7 +22,7 @@ module RailsBestPractices
22
22
 
23
23
  # mappings can be specified by e.g.
24
24
  # post 'some/:pattern' => 'controller#action'
25
- if action_name =~ /^(\w+)#(\w+)$/
25
+ if action_name.is_a?(String) && action_name =~ /\A(\w+)#(\w+)\z/
26
26
  controller_name = $1
27
27
  action_name = $2
28
28
  end
@@ -3,10 +3,10 @@ module RailsBestPractices
3
3
  module Lexicals
4
4
  # Make sure there are no tabs in files.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2011/07/04/remove-tab/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2011/07/04/remove-tab/
7
7
  class RemoveTabCheck < Core::Check
8
8
  interesting_files ALL_FILES
9
- url "http://rails-bestpractices.com/posts/2011/07/04/remove-tab/"
9
+ url "https://rails-bestpractices.com/posts/2011/07/04/remove-tab/"
10
10
 
11
11
  # check if the content of file contains a tab.
12
12
  #
@@ -3,10 +3,10 @@ module RailsBestPractices
3
3
  module Lexicals
4
4
  # Make sure there are no trailing whitespace in codes.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/12/02/remove-trailing-whitespace/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/12/02/remove-trailing-whitespace/
7
7
  class RemoveTrailingWhitespaceCheck < Core::Check
8
8
  interesting_files ALL_FILES
9
- url "http://rails-bestpractices.com/posts/2010/12/02/remove-trailing-whitespace/"
9
+ url "https://rails-bestpractices.com/posts/2010/12/02/remove-trailing-whitespace/"
10
10
 
11
11
  # check if the content of file contain a trailing whitespace.
12
12
  #
@@ -37,6 +37,10 @@ module RailsBestPractices
37
37
  else
38
38
  action_names = [second_argument.hash_value("to").to_s]
39
39
  end
40
+ elsif :symbol_literal == first_argument.sexp_type && second_argument.try(:sexp_type) && \
41
+ :symbol_literal == second_argument.sexp_type
42
+ action_names = node.arguments.all.select \
43
+ {|arg| :symbol_literal == arg.sexp_type }.map(&:to_s)
40
44
  else
41
45
  action_names = [first_argument.to_s]
42
46
  end
@@ -109,6 +113,7 @@ module RailsBestPractices
109
113
  end
110
114
  end
111
115
 
116
+ # TODO: should remove but breaks some tests
112
117
  # remember route for rails2.
113
118
  add_callback :start_command_call do |node|
114
119
  case node.message.to_s
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Make sure to add a model virual attribute to simplify model creation.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/21/add-model-virtual-attribute/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/21/add-model-virtual-attribute/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -16,7 +16,7 @@ module RailsBestPractices
16
16
  class AddModelVirtualAttributeReview < Review
17
17
  interesting_nodes :def
18
18
  interesting_files CONTROLLER_FILES
19
- url "http://rails-bestpractices.com/posts/2010/07/21/add-model-virtual-attribute/"
19
+ url "https://rails-bestpractices.com/posts/2010/07/21/add-model-virtual-attribute/"
20
20
 
21
21
  # check method define nodes to see if there are some attribute assignments that can use model virtual attribute instead in review process.
22
22
  #
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review db/schema.rb file to make sure every reference key has a database index.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/24/always-add-db-index/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/24/always-add-db-index/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -25,7 +25,7 @@ module RailsBestPractices
25
25
  class AlwaysAddDbIndexReview < Review
26
26
  interesting_nodes :command, :command_call
27
27
  interesting_files SCHEMA_FILE
28
- url "http://rails-bestpractices.com/posts/2010/07/24/always-add-db-index/"
28
+ url "https://rails-bestpractices.com/posts/2010/07/24/always-add-db-index/"
29
29
 
30
30
  def initialize(options={})
31
31
  super(options)
@@ -4,7 +4,7 @@ module RailsBestPractices
4
4
  # Review all code to make sure we either check the return value of "save", "update_attributes"
5
5
  # and "create" or use "save!", "update_attributes!", or "create!", respectively.
6
6
  #
7
- # See the best practice details here http://rails-bestpractices.com/posts/2012/11/02/check-the-return-value-of-save-otherwise-use-save/
7
+ # See the best practice details here https://rails-bestpractices.com/posts/2012/11/02/check-the-return-value-of-save-otherwise-use-save/
8
8
  #
9
9
  # Implementation:
10
10
  #
@@ -15,7 +15,7 @@ module RailsBestPractices
15
15
  include Classable
16
16
  interesting_nodes :call, :command_call, :method_add_arg, :if, :ifop, :elsif, :unless, :if_mod, :unless_mod, :assign, :binary
17
17
  interesting_files ALL_FILES
18
- url "http://rails-bestpractices.com/posts/2012/11/02/check-the-return-value-of-save-otherwise-use-save/"
18
+ url "https://rails-bestpractices.com/posts/2012/11/02/check-the-return-value-of-save-otherwise-use-save/"
19
19
 
20
20
  add_callback :start_if, :start_ifop, :start_elsif, :start_unless, :start_if_mod, :start_unless_mod do |node|
21
21
  @used_return_value_of = node.conditional_statement.all_conditions
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review model files to make sure not use default_scope
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2013/06/15/default_scope-is-evil/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2013/06/15/default_scope-is-evil/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -12,7 +12,7 @@ module RailsBestPractices
12
12
  class DefaultScopeIsEvilReview < Review
13
13
  interesting_nodes :command
14
14
  interesting_files MODEL_FILES
15
- url "http://rails-bestpractices.com/posts/2013/06/15/default_scope-is-evil/"
15
+ url "https://rails-bestpractices.com/posts/2013/06/15/default_scope-is-evil/"
16
16
 
17
17
  # check all command nodes' message
18
18
  add_callback :start_command do |node|
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review config/deploy.rb file to make sure using the bundler's capistrano recipe.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/09/02/dry-bundler-in-capistrano/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/09/02/dry-bundler-in-capistrano/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -15,7 +15,7 @@ module RailsBestPractices
15
15
  class DryBundlerInCapistranoReview < Review
16
16
  interesting_nodes :command
17
17
  interesting_files DEPLOY_FILES
18
- url "http://rails-bestpractices.com/posts/2010/09/02/dry-bundler-in-capistrano/"
18
+ url "https://rails-bestpractices.com/posts/2010/09/02/dry-bundler-in-capistrano/"
19
19
 
20
20
  # check call node to see if it is with message "namespace" and argument "bundler".
21
21
  add_callback :start_command do |node|
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Make sure not to insert data in migration, move them to seed file.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/24/isolating-seed-data/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/24/isolating-seed-data/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -21,7 +21,7 @@ module RailsBestPractices
21
21
  class IsolateSeedDataReview < Review
22
22
  interesting_nodes :call, :assign
23
23
  interesting_files MIGRATION_FILES
24
- url "http://rails-bestpractices.com/posts/2010/07/24/isolating-seed-data/"
24
+ url "https://rails-bestpractices.com/posts/2010/07/24/isolating-seed-data/"
25
25
 
26
26
  def initialize(options={})
27
27
  super(options)
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review model files to make sure finders are on their own model.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/23/keep-finders-on-their-own-model/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/23/keep-finders-on-their-own-model/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -17,7 +17,7 @@ module RailsBestPractices
17
17
  class KeepFindersOnTheirOwnModelReview < Review
18
18
  interesting_nodes :method_add_arg
19
19
  interesting_files MODEL_FILES
20
- url "http://rails-bestpractices.com/posts/2010/07/23/keep-finders-on-their-own-model/"
20
+ url "https://rails-bestpractices.com/posts/2010/07/23/keep-finders-on-their-own-model/"
21
21
 
22
22
  FINDERS = %w(find all first last)
23
23
 
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review to make sure not to avoid the law of demeter.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/24/the-law-of-demeter/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/24/the-law-of-demeter/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -16,7 +16,7 @@ module RailsBestPractices
16
16
  class LawOfDemeterReview < Review
17
17
  interesting_nodes :call
18
18
  interesting_files ALL_FILES
19
- url "http://rails-bestpractices.com/posts/2010/07/24/the-law-of-demeter/"
19
+ url "https://rails-bestpractices.com/posts/2010/07/24/the-law-of-demeter/"
20
20
 
21
21
  ASSOCIATION_METHODS = %w(belongs_to has_one)
22
22
 
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review a view file to make sure there is no finder, finder should be moved to controller.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/24/move-code-into-controller/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/24/move-code-into-controller/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -12,7 +12,7 @@ module RailsBestPractices
12
12
  class MoveCodeIntoControllerReview < Review
13
13
  interesting_nodes :method_add_arg, :assign
14
14
  interesting_files VIEW_FILES
15
- url "http://rails-bestpractices.com/posts/2010/07/24/move-code-into-controller/"
15
+ url "https://rails-bestpractices.com/posts/2010/07/24/move-code-into-controller/"
16
16
 
17
17
  FINDERS = %w(find all first last)
18
18
 
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review a view file to make sure there is no complex options_for_select message call.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/24/move-code-into-helper/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/24/move-code-into-helper/
7
7
  #
8
8
  # TODO: we need a better soluation, any suggestion?
9
9
  #
@@ -19,7 +19,7 @@ module RailsBestPractices
19
19
  class MoveCodeIntoHelperReview < Review
20
20
  interesting_nodes :method_add_arg
21
21
  interesting_files VIEW_FILES
22
- url "http://rails-bestpractices.com/posts/2010/07/24/move-code-into-helper/"
22
+ url "https://rails-bestpractices.com/posts/2010/07/24/move-code-into-helper/"
23
23
 
24
24
  def initialize(options = {})
25
25
  super(options)
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review a view file to make sure there is no complex logic call for model.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/24/move-code-into-model/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/24/move-code-into-model/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -13,7 +13,7 @@ module RailsBestPractices
13
13
  class MoveCodeIntoModelReview < Review
14
14
  interesting_nodes :if, :unless, :elsif, :ifop, :if_mod, :unless_mod
15
15
  interesting_files VIEW_FILES
16
- url "http://rails-bestpractices.com/posts/2010/07/24/move-code-into-model/"
16
+ url "https://rails-bestpractices.com/posts/2010/07/24/move-code-into-model/"
17
17
 
18
18
  def initialize(options={})
19
19
  super(options)
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review a controller file to make sure there are no complex finder.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/14/move-finder-to-named_scope/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/14/move-finder-to-named_scope/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -15,7 +15,7 @@ module RailsBestPractices
15
15
  class MoveFinderToNamedScopeReview < Review
16
16
  interesting_nodes :method_add_arg
17
17
  interesting_files CONTROLLER_FILES
18
- url "http://rails-bestpractices.com/posts/2010/07/14/move-finder-to-named_scope/"
18
+ url "https://rails-bestpractices.com/posts/2010/07/14/move-finder-to-named_scope/"
19
19
 
20
20
  FINDERS = %w(find all first last)
21
21
 
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review a controller file to make sure that complex model logic should not exist in controller, should be moved into a model.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/21/move-model-logic-into-the-model/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/21/move-model-logic-into-the-model/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -15,7 +15,7 @@ module RailsBestPractices
15
15
  class MoveModelLogicIntoModelReview < Review
16
16
  interesting_nodes :def
17
17
  interesting_files CONTROLLER_FILES
18
- url "http://rails-bestpractices.com/posts/2010/07/21/move-model-logic-into-the-model/"
18
+ url "https://rails-bestpractices.com/posts/2010/07/21/move-model-logic-into-the-model/"
19
19
 
20
20
  def initialize(options = {})
21
21
  super(options)
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review config/routes.rb file to make sure not to use too deep nesting routes.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/22/needless-deep-nesting/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/22/needless-deep-nesting/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -24,7 +24,7 @@ module RailsBestPractices
24
24
  class NeedlessDeepNestingReview < Review
25
25
  interesting_nodes :method_add_block
26
26
  interesting_files ROUTE_FILES
27
- url "http://rails-bestpractices.com/posts/2010/07/22/needless-deep-nesting/"
27
+ url "https://rails-bestpractices.com/posts/2010/07/22/needless-deep-nesting/"
28
28
 
29
29
  def initialize(options = {})
30
30
  super(options)
@@ -4,7 +4,7 @@ module RailsBestPractices
4
4
  # Review all code to make sure we don't rescue Exception
5
5
  # This is a common mistake by Java or C# devs in ruby.
6
6
  #
7
- # See the best practice details here http://rails-bestpractices.com/posts/2012/11/01/don-t-rescue-exception-rescue-standarderror/
7
+ # See the best practice details here https://rails-bestpractices.com/posts/2012/11/01/don-t-rescue-exception-rescue-standarderror/
8
8
  #
9
9
  # Implementation:
10
10
  #
@@ -13,7 +13,7 @@ module RailsBestPractices
13
13
  class NotRescueExceptionReview < Review
14
14
  interesting_nodes :rescue
15
15
  interesting_files ALL_FILES
16
- url "http://rails-bestpractices.com/posts/2012/11/01/don-t-rescue-exception-rescue-standarderror/"
16
+ url "https://rails-bestpractices.com/posts/2012/11/01/don-t-rescue-exception-rescue-standarderror/"
17
17
 
18
18
  # check rescue node to see if its type is Exception
19
19
  add_callback :start_rescue do |rescue_node|
@@ -3,7 +3,7 @@ module RailsBestPractices
3
3
  module Reviews
4
4
  # Review config/routes file to make sure not use default route that rails generated.
5
5
  #
6
- # See the best practice details here http://rails-bestpractices.com/posts/2010/07/22/not-use-default-route-if-you-use-restful-design/
6
+ # See the best practice details here https://rails-bestpractices.com/posts/2010/07/22/not-use-default-route-if-you-use-restful-design/
7
7
  #
8
8
  # Implementation:
9
9
  #
@@ -19,18 +19,9 @@ module RailsBestPractices
19
19
  class NotUseDefaultRouteReview < Review
20
20
  interesting_nodes :command_call, :command
21
21
  interesting_files ROUTE_FILES
22
- url "http://rails-bestpractices.com/posts/2010/07/22/not-use-default-route-if-you-use-restful-design/"
22
+ url "https://rails-bestpractices.com/posts/2010/07/22/not-use-default-route-if-you-use-restful-design/"
23
23
 
24
- # check all command call nodes, compare with rails2 default route
25
- add_callback :start_command_call do |node|
26
- if "map" == node.receiver.to_s && "connect" == node.message.to_s &&
27
- (":controller/:action/:id" == node.arguments.all.first.to_s ||
28
- ":controller/:action/:id.:format" == node.arguments.all.first.to_s)
29
- add_error "not use default route"
30
- end
31
- end
32
-
33
- # check all command nodes, compare with rails3 default route
24
+ # check all command nodes
34
25
  add_callback :start_command do |node|
35
26
  if "match" == node.message.to_s &&
36
27
  ":controller(/:action(/:id(.:format)))" == node.arguments.all.first.to_s