rails_best_practices 1.19.4 → 1.19.5

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
- SHA1:
3
- metadata.gz: 5465e0c3226433bf68485822ab52b54993f334c4
4
- data.tar.gz: 05650ce6bef4b2c0bd89ac24401d3119c708313f
2
+ SHA256:
3
+ metadata.gz: ce639228ddc1497545e69b3ce97cd43b4832a5e9ebba9cf69e26c01c21831768
4
+ data.tar.gz: 9ea6a9454fbc1cd32c2b924066667e418448fea6c823c045bf7853bc0ea05c63
5
5
  SHA512:
6
- metadata.gz: 514d93fb5333c09d93b65838aeaa3942d693c1e8c1e7b7bf388d198c5b2aca36be0820a97abf29825ef4e127233d1af0d7b911f3968f54e388530cc3e19c08f7
7
- data.tar.gz: f502d73f187def721cbcb7df9c09fc2652b23cdd80f082b96a6301d1a3733f0dceafe0dd1c8c87dd089fcf678761c36aa7f81431908c44f2b9eb2b14a7014858
6
+ metadata.gz: e89e188603ede56c8f538f1415c352aa477fa8c3b591363380c1603dbbe301af6b0f5b29d834bd3b2e90525eb3418eda50508bdd7fc5a81a40aaf4c75f4e0cab
7
+ data.tar.gz: d318bb1faf3c574f8a88e59a54893af1ff1ffadd5e5542d1243b340bd07d72125214c8d4c9343c47ca32777fe8379ffb0f035093a51abe6a583ef3d80820ac97
data/.travis.yml CHANGED
@@ -1,5 +1,3 @@
1
- sudo: false
2
1
  language: ruby
3
- cache: bundler
4
2
  rvm:
5
- - 2.3.3
3
+ - 2.6.4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Next Release
2
2
 
3
+ ## 1.19.5
4
+
5
+ * Add the link format for vscode
6
+ * Use code_analyzer 0.5.1
7
+
3
8
  ## 1.19.4
4
9
 
5
10
  * Add cli class
data/Gemfile.lock CHANGED
@@ -1,43 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_best_practices (1.19.4)
4
+ rails_best_practices (1.19.5)
5
5
  activesupport
6
- code_analyzer (>= 0.4.8)
6
+ code_analyzer (>= 0.5.1)
7
7
  erubis
8
8
  i18n
9
9
  json
10
- require_all (~> 2.0)
10
+ require_all (~> 3.0)
11
11
  ruby-progressbar
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (5.2.1)
16
+ activesupport (6.0.2.1)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
20
20
  tzinfo (~> 1.1)
21
- awesome_print (1.6.1)
22
- code_analyzer (0.4.8)
21
+ zeitwerk (~> 2.2)
22
+ awesome_print (1.8.0)
23
+ code_analyzer (0.5.1)
23
24
  sexp_processor
24
- coderay (1.1.1)
25
- concurrent-ruby (1.0.5)
26
- coveralls (0.8.11)
27
- json (~> 1.8)
28
- simplecov (~> 0.11.0)
25
+ coderay (1.1.2)
26
+ concurrent-ruby (1.1.5)
27
+ coveralls (0.8.23)
28
+ json (>= 1.8, < 3)
29
+ simplecov (~> 0.16.1)
29
30
  term-ansicolor (~> 1.3)
30
- thor (~> 0.19.1)
31
- tins (~> 1.6.0)
32
- diff-lcs (1.2.5)
33
- docile (1.1.5)
31
+ thor (>= 0.19.4, < 2.0)
32
+ tins (~> 1.6)
33
+ diff-lcs (1.3)
34
+ docile (1.3.2)
34
35
  erubis (2.7.0)
35
- ffi (1.9.10)
36
+ ffi (1.11.3)
36
37
  formatador (0.2.5)
37
- guard (2.13.0)
38
+ guard (2.16.1)
38
39
  formatador (>= 0.2.4)
39
- listen (>= 2.7, <= 4.0)
40
- lumberjack (~> 1.0)
40
+ listen (>= 2.7, < 4.0)
41
+ lumberjack (>= 1.0.12, < 2.0)
41
42
  nenv (~> 0.1)
42
43
  notiffany (~> 0.0)
43
44
  pry (>= 0.9.12)
@@ -46,30 +47,30 @@ GEM
46
47
  guard-rspec (4.3.1)
47
48
  guard (~> 2.1)
48
49
  rspec (>= 2.14, < 4.0)
49
- haml (4.0.7)
50
+ haml (5.1.2)
51
+ temple (>= 0.8.0)
50
52
  tilt
51
- i18n (1.1.1)
53
+ i18n (1.7.0)
52
54
  concurrent-ruby (~> 1.0)
53
- json (1.8.6)
54
- listen (3.0.6)
55
- rb-fsevent (>= 0.9.3)
56
- rb-inotify (>= 0.9.7)
57
- lumberjack (1.0.10)
58
- method_source (0.8.2)
59
- minitest (5.11.3)
55
+ json (2.3.0)
56
+ listen (3.2.1)
57
+ rb-fsevent (~> 0.10, >= 0.10.3)
58
+ rb-inotify (~> 0.9, >= 0.9.10)
59
+ lumberjack (1.0.13)
60
+ method_source (0.9.2)
61
+ minitest (5.13.0)
60
62
  nenv (0.3.0)
61
- notiffany (0.0.8)
63
+ notiffany (0.1.3)
62
64
  nenv (~> 0.1)
63
65
  shellany (~> 0.0)
64
- pry (0.10.3)
66
+ pry (0.12.2)
65
67
  coderay (~> 1.1.0)
66
- method_source (~> 0.8.1)
67
- slop (~> 3.4)
68
+ method_source (~> 0.9.0)
68
69
  rake (10.5.0)
69
- rb-fsevent (0.9.7)
70
- rb-inotify (0.9.7)
71
- ffi (>= 0.5.0)
72
- require_all (2.0.0)
70
+ rb-fsevent (0.10.3)
71
+ rb-inotify (0.10.1)
72
+ ffi (~> 1.0)
73
+ require_all (3.0.0)
73
74
  rspec (2.14.1)
74
75
  rspec-core (~> 2.14.0)
75
76
  rspec-expectations (~> 2.14.0)
@@ -78,27 +79,27 @@ GEM
78
79
  rspec-expectations (2.14.5)
79
80
  diff-lcs (>= 1.1.3, < 2.0)
80
81
  rspec-mocks (2.14.6)
81
- ruby-progressbar (1.10.0)
82
- sexp_processor (4.10.1)
82
+ ruby-progressbar (1.10.1)
83
+ sexp_processor (4.13.0)
83
84
  shellany (0.0.1)
84
- simplecov (0.11.2)
85
- docile (~> 1.1.0)
86
- json (~> 1.8)
85
+ simplecov (0.16.1)
86
+ docile (~> 1.1)
87
+ json (>= 1.8, < 3)
87
88
  simplecov-html (~> 0.10.0)
88
- simplecov-html (0.10.0)
89
- slim (3.0.6)
90
- temple (~> 0.7.3)
91
- tilt (>= 1.3.3, < 2.1)
92
- slop (3.6.0)
93
- temple (0.7.6)
94
- term-ansicolor (1.3.2)
89
+ simplecov-html (0.10.2)
90
+ slim (4.0.1)
91
+ temple (>= 0.7.6, < 0.9)
92
+ tilt (>= 2.0.6, < 2.1)
93
+ temple (0.8.2)
94
+ term-ansicolor (1.7.1)
95
95
  tins (~> 1.0)
96
- thor (0.19.1)
96
+ thor (1.0.1)
97
97
  thread_safe (0.3.6)
98
- tilt (2.0.2)
99
- tins (1.6.0)
100
- tzinfo (1.2.5)
98
+ tilt (2.0.10)
99
+ tins (1.22.2)
100
+ tzinfo (1.2.6)
101
101
  thread_safe (~> 0.1)
102
+ zeitwerk (2.2.2)
102
103
 
103
104
  PLATFORMS
104
105
  ruby
@@ -117,4 +118,4 @@ DEPENDENCIES
117
118
  slim
118
119
 
119
120
  BUNDLED WITH
120
- 1.16.0
121
+ 2.1.2
data/README.md CHANGED
@@ -64,6 +64,7 @@ To see the full list of command-line options, run:
64
64
  -f, --format FORMAT output format
65
65
  --without-color only output plain text without color
66
66
  --with-textmate open file by textmate in html format
67
+ --with-vscode open file by vscode in html format
67
68
  --with-sublime open file by sublime in html format (requires https://github.com/asuth/subl-handler)
68
69
  --with-mvim open file by mvim in html format
69
70
  --with-github GITHUB_NAME open file on github in html format. GITHUB_NAME is like railsbp/rails-bestpractices OR full URL to GitHub:FI repo
@@ -121,6 +121,8 @@
121
121
  <a href='subl://open?url=file://<%= File.expand_path(error.filename) %>&amp;line=<%= error.line_number %>'><%= error.short_filename %></a>
122
122
  <% elsif @mvim %>
123
123
  <a href='mvim://open/?url=file://<%= File.expand_path(error.filename) %>&amp;line=<%= error.line_number %>'><%= error.short_filename %></a>
124
+ <% elsif @vscode %>
125
+ <a href='vscode://file/<%= File.expand_path(error.filename) %>:<%= error.line_number %>'><%= error.short_filename %></a>
124
126
  <% else %>
125
127
  <%= error.short_filename %>
126
128
  <% end %>
@@ -238,6 +238,7 @@ module RailsBestPractices
238
238
  errors: errors,
239
239
  error_types: error_types,
240
240
  textmate: @options['with-textmate'],
241
+ vscode: @options['with-vscode'],
241
242
  sublime: @options['with-sublime'],
242
243
  mvim: @options['with-mvim'],
243
244
  github: @options['with-github'],
@@ -11,6 +11,7 @@ module RailsBestPractices
11
11
  # --output-file FILE output html file for the analyzing result
12
12
  # --without-color only output plain text without color
13
13
  # --with-textmate open file by textmate in html format
14
+ # --with-vscode open file by vscode in html format
14
15
  # --with-sublime open file by sublime in html format (requires subl-handler)
15
16
  # --with-mvim open file by mvim in html format
16
17
  # --with-github GITHUB_NAME open file on github in html format, GITHUB_NAME is like railsbp/rails-bestpractices.com
@@ -52,6 +53,10 @@ module RailsBestPractices
52
53
  options['with-textmate'] = true
53
54
  end
54
55
 
56
+ opts.on('--with-vscode', 'open file by vscode in html format') do
57
+ options['with-vscode'] = true
58
+ end
59
+
55
60
  opts.on('--with-sublime', 'open file by sublime in html format') do
56
61
  options['with-sublime'] = true
57
62
  end
@@ -11,7 +11,7 @@ module RailsBestPractices
11
11
  # Review process:
12
12
  # only check the command and command_calls nodes and at the end of review process,
13
13
  # if the receiver of command node is "create_table", then remember the table names
14
- # if the receiver of command_call node is "integer" or "string" and suffix with _id, then remember it as foreign key
14
+ # if the receiver of command_call node is "integer" or "string" or "bigint" and suffix with _id, then remember it as foreign key
15
15
  # if the receiver of command_call node is "string", the name of it is _type suffixed and there is an integer or string column _id suffixed, then remember it as polymorphic foreign key
16
16
  # if the receiver of command_call node is remembered as foreign key and it have argument non-false "index", then remember the index columns
17
17
  # if the receiver of command node is "add_index", then remember the index columns
@@ -40,7 +40,7 @@ module RailsBestPractices
40
40
  # if the message of command_call node is "create_table", then remember the table name.
41
41
  # if the message of command_call node is "add_index", then remember it as index columns.
42
42
  add_callback :start_command_call do |node|
43
- if %w[integer string].include? node.message.to_s
43
+ if %w[integer string bigint].include? node.message.to_s
44
44
  remember_foreign_key_columns(node)
45
45
  elsif node.message.to_s == 'index'
46
46
  remember_index_columns_inside_table(node)
@@ -37,7 +37,7 @@ module RailsBestPractices
37
37
  node.recursive_children do |child_node|
38
38
  case child_node.sexp_type
39
39
  when :assign
40
- if child_node.receiver[2] == :"."
40
+ if child_node.receiver[2].to_s == '.'
41
41
  remember_variable_use_count(child_node)
42
42
  end
43
43
  when :call
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBestPractices
4
- VERSION = '1.19.4'
4
+ VERSION = '1.19.5'
5
5
  end
@@ -18,11 +18,11 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_dependency('activesupport')
20
20
  # TODO: add a dependency for Rails >= 3 ?
21
- s.add_dependency('code_analyzer', '>= 0.4.8')
21
+ s.add_dependency('code_analyzer', '>= 0.5.1')
22
22
  s.add_dependency('erubis')
23
23
  s.add_dependency('i18n')
24
24
  s.add_dependency('json')
25
- s.add_dependency('require_all', '~> 2.0')
25
+ s.add_dependency('require_all', '~> 3.0')
26
26
  s.add_dependency('ruby-progressbar')
27
27
 
28
28
  s.add_development_dependency('awesome_print')
@@ -252,7 +252,9 @@ module RailsBestPractices
252
252
  it 'should add custom resources routes with {}' do
253
253
  content = <<-EOF
254
254
  RailsBestPracticesCom::Application.routes.draw do
255
- resources :posts, only: [:show] { get :inactive, on: :collection }
255
+ resources :posts, only: [:show] do
256
+ get :inactive, on: :collection
257
+ end
256
258
  end
257
259
  EOF
258
260
  runner.prepare('config/routes.rb', content)
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.4
4
+ version: 1.19.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2019-12-28 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.1
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.1
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
@@ -399,8 +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
- rubyforge_project:
403
- rubygems_version: 2.6.14
402
+ rubygems_version: 3.0.3
404
403
  signing_key:
405
404
  specification_version: 4
406
405
  summary: a code metric tool for rails codes.