rails_best_practices 1.19.5 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce639228ddc1497545e69b3ce97cd43b4832a5e9ebba9cf69e26c01c21831768
4
- data.tar.gz: 9ea6a9454fbc1cd32c2b924066667e418448fea6c823c045bf7853bc0ea05c63
3
+ metadata.gz: 7b66ea6e0e742d6db68f867fed12f8242aa0d767b7b3fb4728043c97984f455a
4
+ data.tar.gz: 6f8ff9290459f8436908396fec8612d6050c7f5b278697475c4601e8931c0c19
5
5
  SHA512:
6
- metadata.gz: e89e188603ede56c8f538f1415c352aa477fa8c3b591363380c1603dbbe301af6b0f5b29d834bd3b2e90525eb3418eda50508bdd7fc5a81a40aaf4c75f4e0cab
7
- data.tar.gz: d318bb1faf3c574f8a88e59a54893af1ff1ffadd5e5542d1243b340bd07d72125214c8d4c9343c47ca32777fe8379ffb0f035093a51abe6a583ef3d80820ac97
6
+ metadata.gz: '03850b2873726ec5f3928bc1a846320927c56793c71221c715bbbc630cd1f10333b52ac9a713a78db3cbf1db6e2f25a34493d06bcce76d184f2447f5d888deb1'
7
+ data.tar.gz: 72586f6144df24dd9fd11861c443554f3903bc0cd8401bd08b1e6a89ff356d545b475b8e465b7e95e1803dd198517695fb91d81d6a746df9654e51525e638365
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.6.4
4
+ script: bundle exec rspec spec
@@ -1,30 +1,15 @@
1
1
  # Next Release
2
2
 
3
- ## 1.19.5
3
+ ## 1.20.0 (2020-02-29)
4
4
 
5
+ * Support ruby 2.7
5
6
  * Add the link format for vscode
6
- * Use code_analyzer 0.5.1
7
-
8
- ## 1.19.4
9
-
10
7
  * Add cli class
11
-
12
- ## 1.19.3
13
-
8
+ * Add table_name and module_prefix to model ignored methods
14
9
  * Fix false positive remove unused method for around_action in
15
10
  controller
16
11
  * Fix current_class_name in end_class callback
17
12
 
18
- ## 1.19.2
19
-
20
- * Integrate with awesomecode.io
21
- * Update to require_all 2.x
22
-
23
- ## 1.19.1
24
-
25
- * Add table_name and module_prefix to model ignored methods
26
- * Forcing requrie_all version
27
-
28
13
  ## 1.19.0 (2017-07-26)
29
14
 
30
15
  * RestrictAutoGeneratedRoutesCheck is compatibale with rails api_only
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_best_practices (1.19.5)
4
+ rails_best_practices (1.20.0)
5
5
  activesupport
6
6
  code_analyzer (>= 0.5.1)
7
7
  erubis
@@ -66,7 +66,7 @@ GEM
66
66
  pry (0.12.2)
67
67
  coderay (~> 1.1.0)
68
68
  method_source (~> 0.9.0)
69
- rake (10.5.0)
69
+ rake (13.0.1)
70
70
  rb-fsevent (0.10.3)
71
71
  rb-inotify (0.10.1)
72
72
  ffi (~> 1.0)
@@ -113,9 +113,9 @@ DEPENDENCIES
113
113
  haml
114
114
  pry
115
115
  rails_best_practices!
116
- rake (< 11.0)
116
+ rake
117
117
  rspec (~> 2.14.0)
118
118
  slim
119
119
 
120
120
  BUNDLED WITH
121
- 2.1.2
121
+ 2.1.4
data/Rakefile CHANGED
@@ -1,18 +1 @@
1
- require 'bundler'
2
1
  require 'bundler/gem_tasks'
3
-
4
- Bundler.setup
5
-
6
- require 'rake'
7
- require 'rspec'
8
- require 'rspec/core/rake_task'
9
-
10
- $LOAD_PATH.unshift File.expand_path('lib', __dir__)
11
- require 'rails_best_practices/version'
12
-
13
- RSpec::Core::RakeTask.new(:spec) do |spec|
14
- spec.pattern = 'spec/**/*_spec.rb'
15
- end
16
-
17
- task default: :spec
18
- task test: :spec
@@ -146,7 +146,7 @@ module RailsBestPractices
146
146
  def remove_table_not_exist_foreign_keys
147
147
  @foreign_keys.each do |table, foreign_keys|
148
148
  foreign_keys.delete_if do |key|
149
- if key =~ /_id$/
149
+ if key.is_a?(String) && key =~ /_id$/
150
150
  class_name = Prepares.model_associations.get_association_class_name(table, key[0..-4])
151
151
  class_name ? !@table_nodes[class_name.gsub('::', '').tableize] : !@table_nodes[key[0..-4].pluralize]
152
152
  end
@@ -157,7 +157,7 @@ module RailsBestPractices
157
157
  # remove the non foreign keys with only _type column.
158
158
  def remove_only_type_foreign_keys
159
159
  @foreign_keys.each do |_table, foreign_keys|
160
- foreign_keys.delete_if { |key| key =~ /_type$/ }
160
+ foreign_keys.delete_if { |key| key.is_a?(String) && key =~ /_type$/ }
161
161
  end
162
162
  end
163
163
 
@@ -46,7 +46,7 @@ module RailsBestPractices
46
46
  # check an attribute assignment node, if its message is xxx_id,
47
47
  # then remember the receiver of the attribute assignment in @assignments.
48
48
  def attribute_assignment(node)
49
- if node.left_value.message.to_s =~ /_id$/
49
+ if node.left_value.message.is_a?(Sexp) && node.left_value.message.to_s =~ /_id$/
50
50
  receiver = node.left_value.receiver.to_s
51
51
  @assignments[receiver] = true
52
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBestPractices
4
- VERSION = '1.19.5'
4
+ VERSION = '1.20.0'
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency('awesome_print')
29
29
  s.add_development_dependency('bundler')
30
30
  s.add_development_dependency('haml')
31
- s.add_development_dependency('rake', '< 11.0')
31
+ s.add_development_dependency('rake')
32
32
  s.add_development_dependency('rspec')
33
33
  s.add_development_dependency('slim')
34
34
 
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.5
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-28 00:00:00.000000000 Z
11
+ date: 2020-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -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
@@ -399,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
399
  - !ruby/object:Gem::Version
400
400
  version: 1.3.6
401
401
  requirements: []
402
- rubygems_version: 3.0.3
402
+ rubygems_version: 3.1.0.pre1
403
403
  signing_key:
404
404
  specification_version: 4
405
405
  summary: a code metric tool for rails codes.