rails_best_practices 1.21.0 → 1.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +48 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +38 -38
- data/Gemfile.ruby-2.6 +11 -0
- data/Gemfile.ruby-2.6.lock +130 -0
- data/README.md +1 -1
- data/assets/result.html.erb +2 -0
- data/lib/rails_best_practices/analyzer.rb +1 -0
- data/lib/rails_best_practices/core/check.rb +10 -5
- data/lib/rails_best_practices/option_parser.rb +5 -0
- data/lib/rails_best_practices/version.rb +1 -1
- data/rails_best_practices.gemspec +10 -8
- data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +22 -0
- metadata +11 -8
- data/.travis.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdd81904314b75ffb168757035157e2e28627f890691ee869b567721485bb7ab
|
4
|
+
data.tar.gz: 98bd1b3d60c5a0218af2597f0ddf2a9d82f7375f2fe8466fc11d0f26f2f38e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7bc62f7d7c9e69b69eadd2abc323aefd5e107135a29e6d91333f178c5f945621eb7b04d030745837335a706b0cd7a6628ec384d28ba407cbebb83e1f938cf1d
|
7
|
+
data.tar.gz: b6c9dfba7e08e08cad07fbc74fcc5c66f3ee24659e07376365afea89b9f6490b98b0c6c4925c74782788369cbdc9788fbb8764607464b16e1c97f34b2835276c
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: CI
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test_ruby_2_6:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
strategy:
|
20
|
+
matrix:
|
21
|
+
ruby-version: ['2.6']
|
22
|
+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
23
|
+
BUNDLE_GEMFILE: Gemfile.ruby-2.6
|
24
|
+
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v2
|
27
|
+
- name: Set up Ruby
|
28
|
+
uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: ${{ matrix.ruby-version }}
|
31
|
+
bundler-cache: true
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rspec spec
|
34
|
+
test_ruby_2_7_above:
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
strategy:
|
37
|
+
matrix:
|
38
|
+
ruby-version: ['2.7', '3.0', '3.1']
|
39
|
+
|
40
|
+
steps:
|
41
|
+
- uses: actions/checkout@v2
|
42
|
+
- name: Set up Ruby
|
43
|
+
uses: ruby/setup-ruby@v1
|
44
|
+
with:
|
45
|
+
ruby-version: ${{ matrix.ruby-version }}
|
46
|
+
bundler-cache: true
|
47
|
+
- name: Run tests
|
48
|
+
run: bundle exec rspec spec
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Next Release
|
2
2
|
|
3
|
+
## 1.23.1 (2022-02-12)
|
4
|
+
|
5
|
+
* Do not strict activesupport dependency version
|
6
|
+
|
7
|
+
## 1.23.0 (2022-01-31)
|
8
|
+
|
9
|
+
* Support hash short syntax
|
10
|
+
|
11
|
+
## 1.22.0 (2021-10-27)
|
12
|
+
|
13
|
+
* Support atom editor
|
14
|
+
|
3
15
|
## 1.21.0 (2021-06-15)
|
4
16
|
|
5
17
|
* Disable check by inline comment
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails_best_practices (1.
|
4
|
+
rails_best_practices (1.23.1)
|
5
5
|
activesupport
|
6
|
-
code_analyzer (
|
6
|
+
code_analyzer (~> 0.5.5)
|
7
7
|
erubis
|
8
8
|
i18n
|
9
9
|
json
|
@@ -13,79 +13,80 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activesupport (
|
16
|
+
activesupport (7.0.2.2)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
|
-
zeitwerk (~> 2.3)
|
22
21
|
awesome_print (1.8.0)
|
23
|
-
code_analyzer (0.5.
|
22
|
+
code_analyzer (0.5.5)
|
24
23
|
sexp_processor
|
25
|
-
coderay (1.1.
|
26
|
-
concurrent-ruby (1.1.
|
24
|
+
coderay (1.1.3)
|
25
|
+
concurrent-ruby (1.1.9)
|
27
26
|
coveralls (0.8.23)
|
28
27
|
json (>= 1.8, < 3)
|
29
28
|
simplecov (~> 0.16.1)
|
30
29
|
term-ansicolor (~> 1.3)
|
31
30
|
thor (>= 0.19.4, < 2.0)
|
32
31
|
tins (~> 1.6)
|
33
|
-
diff-lcs (1.
|
32
|
+
diff-lcs (1.4.4)
|
34
33
|
docile (1.3.2)
|
35
34
|
erubis (2.7.0)
|
36
|
-
ffi (1.
|
37
|
-
formatador (0.
|
38
|
-
guard (2.
|
35
|
+
ffi (1.15.4)
|
36
|
+
formatador (0.3.0)
|
37
|
+
guard (2.18.0)
|
39
38
|
formatador (>= 0.2.4)
|
40
39
|
listen (>= 2.7, < 4.0)
|
41
40
|
lumberjack (>= 1.0.12, < 2.0)
|
42
41
|
nenv (~> 0.1)
|
43
42
|
notiffany (~> 0.0)
|
44
|
-
pry (>= 0.
|
43
|
+
pry (>= 0.13.0)
|
45
44
|
shellany (~> 0.0)
|
46
45
|
thor (>= 0.18.1)
|
47
|
-
guard-
|
46
|
+
guard-compat (1.2.1)
|
47
|
+
guard-rspec (4.7.3)
|
48
48
|
guard (~> 2.1)
|
49
|
-
|
49
|
+
guard-compat (~> 1.1)
|
50
|
+
rspec (>= 2.99.0, < 4.0)
|
50
51
|
haml (5.1.2)
|
51
52
|
temple (>= 0.8.0)
|
52
53
|
tilt
|
53
|
-
i18n (1.
|
54
|
+
i18n (1.9.1)
|
54
55
|
concurrent-ruby (~> 1.0)
|
55
56
|
json (2.3.0)
|
56
|
-
listen (3.
|
57
|
+
listen (3.7.0)
|
57
58
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
58
59
|
rb-inotify (~> 0.9, >= 0.9.10)
|
59
|
-
lumberjack (1.
|
60
|
-
method_source (0.
|
61
|
-
minitest (5.
|
60
|
+
lumberjack (1.2.8)
|
61
|
+
method_source (1.0.0)
|
62
|
+
minitest (5.15.0)
|
62
63
|
nenv (0.3.0)
|
63
64
|
notiffany (0.1.3)
|
64
65
|
nenv (~> 0.1)
|
65
66
|
shellany (~> 0.0)
|
66
|
-
pry (0.
|
67
|
-
coderay (~> 1.1
|
68
|
-
method_source (~>
|
67
|
+
pry (0.14.1)
|
68
|
+
coderay (~> 1.1)
|
69
|
+
method_source (~> 1.0)
|
69
70
|
rake (13.0.1)
|
70
|
-
rb-fsevent (0.
|
71
|
+
rb-fsevent (0.11.0)
|
71
72
|
rb-inotify (0.10.1)
|
72
73
|
ffi (~> 1.0)
|
73
74
|
require_all (3.0.0)
|
74
|
-
rspec (3.
|
75
|
-
rspec-core (~> 3.
|
76
|
-
rspec-expectations (~> 3.
|
77
|
-
rspec-mocks (~> 3.
|
78
|
-
rspec-core (3.
|
79
|
-
rspec-support (~> 3.
|
80
|
-
rspec-expectations (3.
|
75
|
+
rspec (3.10.0)
|
76
|
+
rspec-core (~> 3.10.0)
|
77
|
+
rspec-expectations (~> 3.10.0)
|
78
|
+
rspec-mocks (~> 3.10.0)
|
79
|
+
rspec-core (3.10.1)
|
80
|
+
rspec-support (~> 3.10.0)
|
81
|
+
rspec-expectations (3.10.1)
|
81
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-mocks (3.
|
83
|
+
rspec-support (~> 3.10.0)
|
84
|
+
rspec-mocks (3.10.2)
|
84
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-support (3.
|
86
|
+
rspec-support (~> 3.10.0)
|
87
|
+
rspec-support (3.10.2)
|
87
88
|
ruby-progressbar (1.11.0)
|
88
|
-
sexp_processor (4.
|
89
|
+
sexp_processor (4.16.0)
|
89
90
|
shellany (0.0.1)
|
90
91
|
simplecov (0.16.1)
|
91
92
|
docile (~> 1.1)
|
@@ -98,12 +99,11 @@ GEM
|
|
98
99
|
temple (0.8.2)
|
99
100
|
term-ansicolor (1.7.1)
|
100
101
|
tins (~> 1.0)
|
101
|
-
thor (1.0
|
102
|
+
thor (1.1.0)
|
102
103
|
tilt (2.0.10)
|
103
104
|
tins (1.22.2)
|
104
105
|
tzinfo (2.0.4)
|
105
106
|
concurrent-ruby (~> 1.0)
|
106
|
-
zeitwerk (2.4.2)
|
107
107
|
|
108
108
|
PLATFORMS
|
109
109
|
ruby
|
@@ -122,4 +122,4 @@ DEPENDENCIES
|
|
122
122
|
slim
|
123
123
|
|
124
124
|
BUNDLED WITH
|
125
|
-
2.
|
125
|
+
2.2.22
|
data/Gemfile.ruby-2.6
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails_best_practices (1.23.1)
|
5
|
+
activesupport
|
6
|
+
code_analyzer (~> 0.5.5)
|
7
|
+
erubis
|
8
|
+
i18n
|
9
|
+
json
|
10
|
+
require_all (~> 3.0)
|
11
|
+
ruby-progressbar
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
activesupport (6.1.4.6)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
tzinfo (~> 2.0)
|
21
|
+
zeitwerk (~> 2.3)
|
22
|
+
awesome_print (1.9.2)
|
23
|
+
code_analyzer (0.5.5)
|
24
|
+
sexp_processor
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.1.9)
|
27
|
+
coveralls (0.8.23)
|
28
|
+
json (>= 1.8, < 3)
|
29
|
+
simplecov (~> 0.16.1)
|
30
|
+
term-ansicolor (~> 1.3)
|
31
|
+
thor (>= 0.19.4, < 2.0)
|
32
|
+
tins (~> 1.6)
|
33
|
+
diff-lcs (1.5.0)
|
34
|
+
docile (1.4.0)
|
35
|
+
erubis (2.7.0)
|
36
|
+
ffi (1.15.5)
|
37
|
+
formatador (1.1.0)
|
38
|
+
guard (2.18.0)
|
39
|
+
formatador (>= 0.2.4)
|
40
|
+
listen (>= 2.7, < 4.0)
|
41
|
+
lumberjack (>= 1.0.12, < 2.0)
|
42
|
+
nenv (~> 0.1)
|
43
|
+
notiffany (~> 0.0)
|
44
|
+
pry (>= 0.13.0)
|
45
|
+
shellany (~> 0.0)
|
46
|
+
thor (>= 0.18.1)
|
47
|
+
guard-compat (1.2.1)
|
48
|
+
guard-rspec (4.7.3)
|
49
|
+
guard (~> 2.1)
|
50
|
+
guard-compat (~> 1.1)
|
51
|
+
rspec (>= 2.99.0, < 4.0)
|
52
|
+
haml (5.2.2)
|
53
|
+
temple (>= 0.8.0)
|
54
|
+
tilt
|
55
|
+
i18n (1.9.1)
|
56
|
+
concurrent-ruby (~> 1.0)
|
57
|
+
json (2.6.1)
|
58
|
+
listen (3.7.1)
|
59
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
60
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
61
|
+
lumberjack (1.2.8)
|
62
|
+
method_source (1.0.0)
|
63
|
+
minitest (5.15.0)
|
64
|
+
nenv (0.3.0)
|
65
|
+
notiffany (0.1.3)
|
66
|
+
nenv (~> 0.1)
|
67
|
+
shellany (~> 0.0)
|
68
|
+
pry (0.14.1)
|
69
|
+
coderay (~> 1.1)
|
70
|
+
method_source (~> 1.0)
|
71
|
+
rake (13.0.6)
|
72
|
+
rb-fsevent (0.11.1)
|
73
|
+
rb-inotify (0.10.1)
|
74
|
+
ffi (~> 1.0)
|
75
|
+
require_all (3.0.0)
|
76
|
+
rspec (3.11.0)
|
77
|
+
rspec-core (~> 3.11.0)
|
78
|
+
rspec-expectations (~> 3.11.0)
|
79
|
+
rspec-mocks (~> 3.11.0)
|
80
|
+
rspec-core (3.11.0)
|
81
|
+
rspec-support (~> 3.11.0)
|
82
|
+
rspec-expectations (3.11.0)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.11.0)
|
85
|
+
rspec-mocks (3.11.0)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.11.0)
|
88
|
+
rspec-support (3.11.0)
|
89
|
+
ruby-progressbar (1.11.0)
|
90
|
+
sexp_processor (4.16.0)
|
91
|
+
shellany (0.0.1)
|
92
|
+
simplecov (0.16.1)
|
93
|
+
docile (~> 1.1)
|
94
|
+
json (>= 1.8, < 3)
|
95
|
+
simplecov-html (~> 0.10.0)
|
96
|
+
simplecov-html (0.10.2)
|
97
|
+
slim (4.1.0)
|
98
|
+
temple (>= 0.7.6, < 0.9)
|
99
|
+
tilt (>= 2.0.6, < 2.1)
|
100
|
+
sync (0.5.0)
|
101
|
+
temple (0.8.2)
|
102
|
+
term-ansicolor (1.7.1)
|
103
|
+
tins (~> 1.0)
|
104
|
+
thor (1.2.1)
|
105
|
+
tilt (2.0.10)
|
106
|
+
tins (1.31.0)
|
107
|
+
sync
|
108
|
+
tzinfo (2.0.4)
|
109
|
+
concurrent-ruby (~> 1.0)
|
110
|
+
zeitwerk (2.5.4)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
ruby
|
114
|
+
|
115
|
+
DEPENDENCIES
|
116
|
+
activesupport (~> 6.1.4)
|
117
|
+
awesome_print
|
118
|
+
bundler
|
119
|
+
coveralls
|
120
|
+
guard
|
121
|
+
guard-rspec
|
122
|
+
haml
|
123
|
+
pry
|
124
|
+
rails_best_practices!
|
125
|
+
rake
|
126
|
+
rspec
|
127
|
+
slim
|
128
|
+
|
129
|
+
BUNDLED WITH
|
130
|
+
1.17.3
|
data/README.md
CHANGED
@@ -284,7 +284,7 @@ Follow us on twitter: <http://twitter.com/railsbp>
|
|
284
284
|
Send us email: <team@railsbp.com>
|
285
285
|
|
286
286
|
|
287
|
-
Copyright © 2009 -
|
287
|
+
Copyright © 2009 - 2022 Richard Huang (flyerhzm@gmail.com), released under the MIT license
|
288
288
|
|
289
289
|
|
290
290
|
[1]: https://github.com/railsbp/rails_best_practices/wiki/How-to-write-your-own-check-list
|
data/assets/result.html.erb
CHANGED
@@ -115,6 +115,8 @@
|
|
115
115
|
<td class='filename'>
|
116
116
|
<% if @github %>
|
117
117
|
<a href='<%= @github_name %>/blob/<%= @last_commit_id %>/<%= error.short_filename %>#L<%= error.first_line_number %>' target='_blank'><%= error.short_filename %></a>
|
118
|
+
<% elsif @atom %>
|
119
|
+
<a href='atom://core/open/file?filename=<%= File.expand_path(error.filename) %>&line=<%= error.line_number %>'><%= error.short_filename %></a>
|
118
120
|
<% elsif @textmate %>
|
119
121
|
<a href='txmt://open/?url=file://<%= File.expand_path(error.filename) %>&line=<%= error.line_number %>'><%= error.short_filename %></a>
|
120
122
|
<% elsif @sublime %>
|
@@ -249,6 +249,7 @@ module RailsBestPractices
|
|
249
249
|
file.puts eruby.evaluate(
|
250
250
|
errors: errors,
|
251
251
|
error_types: error_types,
|
252
|
+
atom: @options['with-atom'],
|
252
253
|
textmate: @options['with-textmate'],
|
253
254
|
vscode: @options['with-vscode'],
|
254
255
|
sublime: @options['with-sublime'],
|
@@ -204,7 +204,7 @@ module RailsBestPractices
|
|
204
204
|
:command_call,
|
205
205
|
:command,
|
206
206
|
:alias,
|
207
|
-
:
|
207
|
+
:assoc_new,
|
208
208
|
:method_add_arg
|
209
209
|
|
210
210
|
# remembe the message of call node.
|
@@ -269,9 +269,12 @@ module RailsBestPractices
|
|
269
269
|
# def to_xml(options = {})
|
270
270
|
# super options.merge(exclude: :visible, methods: [:is_discussion_conversation])
|
271
271
|
# end
|
272
|
-
add_callback :
|
273
|
-
if node.
|
274
|
-
mark_used(node.
|
272
|
+
add_callback :start_assoc_new do |node|
|
273
|
+
if node.key == 'methods'
|
274
|
+
mark_used(node.value)
|
275
|
+
end
|
276
|
+
if node.value.nil?
|
277
|
+
mark_used(node.key)
|
275
278
|
end
|
276
279
|
end
|
277
280
|
|
@@ -294,7 +297,9 @@ module RailsBestPractices
|
|
294
297
|
def mark_used(method_node)
|
295
298
|
return if method_node == :call
|
296
299
|
|
297
|
-
if method_node.
|
300
|
+
if method_node.is_a?(String)
|
301
|
+
method_name = method_node
|
302
|
+
elsif method_node.sexp_type == :bare_assoc_hash
|
298
303
|
method_node.hash_values.each { |value_node| mark_used(value_node) }
|
299
304
|
elsif method_node.sexp_type == :array
|
300
305
|
method_node.array_values.each { |value_node| mark_used(value_node) }
|
@@ -10,6 +10,7 @@ module RailsBestPractices
|
|
10
10
|
# -f, --format FORMAT output format (text, html, yaml, json, xml)
|
11
11
|
# --output-file FILE output html file for the analyzing result
|
12
12
|
# --without-color only output plain text without color
|
13
|
+
# --with-atom open file by atom in html format
|
13
14
|
# --with-textmate open file by textmate in html format
|
14
15
|
# --with-vscode open file by vscode in html format
|
15
16
|
# --with-sublime open file by sublime in html format (requires subl-handler)
|
@@ -49,6 +50,10 @@ module RailsBestPractices
|
|
49
50
|
options['without-color'] = true
|
50
51
|
end
|
51
52
|
|
53
|
+
opts.on('--with-atom', 'open file by atom in html format') do
|
54
|
+
options['with-atom'] = true
|
55
|
+
end
|
56
|
+
|
52
57
|
opts.on('--with-textmate', 'open file by textmate in html format') do
|
53
58
|
options['with-textmate'] = true
|
54
59
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rails_best_practices/version'
|
4
6
|
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = 'rails_best_practices'
|
@@ -16,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
16
18
|
spec.required_ruby_version = '>= 1.9.0'
|
17
19
|
spec.required_rubygems_version = '>= 1.3.6'
|
18
20
|
|
19
|
-
spec.
|
20
|
-
spec.
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
spec.
|
24
|
-
spec.
|
25
|
-
spec.
|
21
|
+
spec.add_runtime_dependency('activesupport')
|
22
|
+
spec.add_runtime_dependency('code_analyzer', '~> 0.5.5')
|
23
|
+
spec.add_runtime_dependency('erubis')
|
24
|
+
spec.add_runtime_dependency('i18n')
|
25
|
+
spec.add_runtime_dependency('json')
|
26
|
+
spec.add_runtime_dependency('require_all', '~> 3.0')
|
27
|
+
spec.add_runtime_dependency('ruby-progressbar')
|
26
28
|
|
27
29
|
spec.add_development_dependency('awesome_print')
|
28
30
|
spec.add_development_dependency('bundler')
|
@@ -556,6 +556,28 @@ module RailsBestPractices
|
|
556
556
|
end
|
557
557
|
end
|
558
558
|
|
559
|
+
if RUBY_VERSION.to_f > 3.0
|
560
|
+
context 'short syntax value' do
|
561
|
+
it 'does not remove unused method' do
|
562
|
+
content = <<-EOF
|
563
|
+
class Post < ActiveRecord::Base
|
564
|
+
def build
|
565
|
+
new(value:)
|
566
|
+
end
|
567
|
+
|
568
|
+
def value
|
569
|
+
'value'
|
570
|
+
end
|
571
|
+
end
|
572
|
+
EOF
|
573
|
+
runner.prepare('app/models/post.rb', content)
|
574
|
+
runner.review('app/models/post.rb', content)
|
575
|
+
runner.after_review
|
576
|
+
expect(runner.errors.size).to eq(1)
|
577
|
+
end
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
559
581
|
context 'callbacks' do
|
560
582
|
it 'does not remove unused method' do
|
561
583
|
content = <<-EOF
|
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.
|
4
|
+
version: 1.23.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: code_analyzer
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.5.
|
33
|
+
version: 0.5.5
|
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.5.
|
40
|
+
version: 0.5.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: erubis
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,12 +200,15 @@ executables:
|
|
200
200
|
extensions: []
|
201
201
|
extra_rdoc_files: []
|
202
202
|
files:
|
203
|
+
- ".github/workflows/main.yml"
|
203
204
|
- ".gitignore"
|
204
205
|
- ".rspec"
|
205
|
-
- ".
|
206
|
+
- ".ruby-version"
|
206
207
|
- CHANGELOG.md
|
207
208
|
- Gemfile
|
208
209
|
- Gemfile.lock
|
210
|
+
- Gemfile.ruby-2.6
|
211
|
+
- Gemfile.ruby-2.6.lock
|
209
212
|
- Guardfile
|
210
213
|
- MIT_LICENSE
|
211
214
|
- README.md
|
@@ -403,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
403
406
|
- !ruby/object:Gem::Version
|
404
407
|
version: 1.3.6
|
405
408
|
requirements: []
|
406
|
-
rubygems_version: 3.
|
409
|
+
rubygems_version: 3.3.3
|
407
410
|
signing_key:
|
408
411
|
specification_version: 4
|
409
412
|
summary: a code metric tool for rails codes.
|
data/.travis.yml
DELETED