rubocop-scc 0.2.2 → 1.0.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.
- checksums.yaml +4 -4
- data/config/default.yml +1 -1
- data/config/rails.yml +11 -11
- data/guides/rails-controller-render-shorthand.md +1 -1
- data/guides/rails-render-inline.md +1 -1
- data/guides/rails-render-literal.md +1 -1
- data/lib/rubocop/cop/sequoiacap.rb +11 -0
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/class_name.rb +2 -4
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/default_scope.rb +1 -1
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/factory_class_use_string.rb +2 -4
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/no_timeout.rb +1 -1
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/rails_controller_render_action_symbol.rb +1 -1
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/rails_controller_render_literal.rb +2 -4
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/rails_controller_render_paths_exist.rb +4 -10
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/rails_controller_render_shorthand.rb +1 -1
- data/lib/rubocop/cop/{sequioacap → sequoiacap}/simple_modifier_conditional.rb +1 -1
- metadata +21 -22
- data/lib/rubocop/cop/sequioacap.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f00c8d00c7989c4142a2127787fbdd4563f9cfb9ce599f4acae514a41fa341b9
|
4
|
+
data.tar.gz: 37e75c158ee38448769e28d1b4b51d2bbcb41cb9194034b5467a793ed170eef3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b31efdd916434ac19a15058ebf1e22998f5915d4b617a8c99f2df1ed211b41e0ac929a5206b28947eb32a4a09aea72a22ead324477a06ca3e36d54c181340b5
|
7
|
+
data.tar.gz: 72ef8bc1f2949688b254b1db56c32bd907e9d327722f5534d1e0aab3378468bb181e82d4b660aa7ca3ade30bed853d85c739448f9af046321204c95245836996
|
data/config/default.yml
CHANGED
data/config/rails.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require: rubocop/cop/
|
1
|
+
require: rubocop/cop/sequoiacap
|
2
2
|
|
3
3
|
Rails:
|
4
4
|
Enabled: true
|
@@ -98,47 +98,47 @@ Rails/Validation:
|
|
98
98
|
Rails/UniqBeforePluck:
|
99
99
|
Enabled: true
|
100
100
|
|
101
|
-
|
101
|
+
sequoiacap/RailsControllerRenderActionSymbol:
|
102
102
|
Enabled: true
|
103
103
|
Include:
|
104
104
|
- 'app/controllers/**/*.rb'
|
105
105
|
|
106
|
-
|
106
|
+
sequoiacap/RailsControllerRenderLiteral:
|
107
107
|
Enabled: true
|
108
108
|
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
|
109
109
|
Include:
|
110
110
|
- 'app/controllers/**/*.rb'
|
111
111
|
|
112
|
-
|
113
|
-
Enabled:
|
112
|
+
sequoiacap/RailsControllerRenderPathsExist:
|
113
|
+
Enabled: false
|
114
114
|
ViewPath:
|
115
115
|
- 'app/views'
|
116
116
|
Include:
|
117
117
|
- 'app/controllers/**/*.rb'
|
118
118
|
|
119
|
-
|
119
|
+
sequoiacap/RailsControllerRenderShorthand:
|
120
120
|
Enabled: true
|
121
121
|
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-shorthand.md
|
122
122
|
Include:
|
123
123
|
- 'app/controllers/**/*.rb'
|
124
124
|
|
125
|
-
|
125
|
+
sequoiacap/ClassName:
|
126
126
|
Description: Use :class_name => "Model" instead of :class_name => Model.name
|
127
127
|
to avoid a long cascade of autoloading.
|
128
128
|
Enabled: true
|
129
129
|
|
130
|
-
|
130
|
+
sequoiacap/DefaultScope:
|
131
131
|
Description: Avoid `default_scope`. Default scopes make it difficult to
|
132
132
|
refactor data access patterns since the scope becomes part of every query unless
|
133
133
|
explicitly excluded, even when it is unnecessary or incidental to the desired logic.
|
134
134
|
Enabled: true
|
135
135
|
|
136
|
-
|
136
|
+
sequoiacap/FactoryClassUseString:
|
137
137
|
Description: Cop to tell developers to use :class => "MyClass" instead of :class => MyClass,
|
138
138
|
because the latter slows down reloading zeus.
|
139
139
|
Enabled: true
|
140
140
|
|
141
|
-
|
141
|
+
sequoiacap/NoTimeout:
|
142
142
|
Description: Do not use Timeout.timeout. In combination with Rails autoloading,
|
143
143
|
timeout can cause Segmentation Faults in version of Ruby we use.
|
144
144
|
It can also cause logic errors since it can raise in
|
@@ -146,7 +146,7 @@ Sequioacap/NoTimeout:
|
|
146
146
|
ensure proper timing behavior for web requests.
|
147
147
|
Enabled: true
|
148
148
|
|
149
|
-
|
149
|
+
sequoiacap/SimpleModifierConditional:
|
150
150
|
Enabled: true
|
151
151
|
StyleGuide: https://github.com/airbnb/ruby#only-simple-if-unless
|
152
152
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop/cop/sequoiacap/class_name'
|
4
|
+
require 'rubocop/cop/sequoiacap/default_scope'
|
5
|
+
require 'rubocop/cop/sequoiacap/factory_class_use_string'
|
6
|
+
require 'rubocop/cop/sequoiacap/no_timeout'
|
7
|
+
require 'rubocop/cop/sequoiacap/rails_controller_render_action_symbol'
|
8
|
+
require 'rubocop/cop/sequoiacap/rails_controller_render_literal'
|
9
|
+
require 'rubocop/cop/sequoiacap/rails_controller_render_paths_exist'
|
10
|
+
require 'rubocop/cop/sequoiacap/rails_controller_render_shorthand'
|
11
|
+
require 'rubocop/cop/sequoiacap/simple_modifier_conditional'
|
@@ -4,7 +4,7 @@ require 'rubocop'
|
|
4
4
|
|
5
5
|
module RuboCop
|
6
6
|
module Cop
|
7
|
-
module
|
7
|
+
module Sequoiacap
|
8
8
|
# Cop to prevent cross-model references, which result in a cascade of autoloads. E.g.,
|
9
9
|
# belongs_to :user, :class_name => User.name
|
10
10
|
class ClassName < Cop
|
@@ -24,9 +24,7 @@ module RuboCop
|
|
24
24
|
|
25
25
|
class_pair = class_name_node(node)
|
26
26
|
|
27
|
-
if class_pair && !string_class_name?(class_pair)
|
28
|
-
add_offense(class_pair)
|
29
|
-
end
|
27
|
+
add_offense(class_pair) if class_pair && !string_class_name?(class_pair)
|
30
28
|
end
|
31
29
|
|
32
30
|
private
|
@@ -4,7 +4,7 @@ require 'rubocop'
|
|
4
4
|
|
5
5
|
module RuboCop
|
6
6
|
module Cop
|
7
|
-
module
|
7
|
+
module Sequoiacap
|
8
8
|
# Cop to tell developers to use :class => "MyClass" instead of :class => MyClass,
|
9
9
|
# because the latter slows down reloading zeus.
|
10
10
|
class FactoryClassUseString < Cop
|
@@ -16,9 +16,7 @@ module RuboCop
|
|
16
16
|
|
17
17
|
class_pair = class_node(node)
|
18
18
|
|
19
|
-
if class_pair && !string_class_name?(class_pair)
|
20
|
-
add_offense(class_pair)
|
21
|
-
end
|
19
|
+
add_offense(class_pair) if class_pair && !string_class_name?(class_pair)
|
22
20
|
end
|
23
21
|
|
24
22
|
private
|
@@ -4,7 +4,7 @@ require 'rubocop'
|
|
4
4
|
|
5
5
|
module RuboCop
|
6
6
|
module Cop
|
7
|
-
module
|
7
|
+
module Sequoiacap
|
8
8
|
class RailsControllerRenderLiteral < Cop
|
9
9
|
MSG = 'render must be used with a string literal'
|
10
10
|
|
@@ -70,9 +70,7 @@ module RuboCop
|
|
70
70
|
return if option_pairs.any? { |pair| ignore_key?(pair) }
|
71
71
|
template_node = option_pairs.map { |pair| template_key?(pair) }.compact.first
|
72
72
|
if template_node
|
73
|
-
if !literal?(template_node)
|
74
|
-
add_offense(node, location: :expression)
|
75
|
-
end
|
73
|
+
add_offense(node, location: :expression) if !literal?(template_node)
|
76
74
|
else
|
77
75
|
add_offense(node, location: :expression)
|
78
76
|
end
|
@@ -4,7 +4,7 @@ require 'rubocop'
|
|
4
4
|
|
5
5
|
module RuboCop
|
6
6
|
module Cop
|
7
|
-
module
|
7
|
+
module Sequoiacap
|
8
8
|
class RailsControllerRenderPathsExist < Cop
|
9
9
|
def_node_matcher :render?, <<-PATTERN
|
10
10
|
(send nil? :render $...)
|
@@ -27,22 +27,16 @@ module RuboCop
|
|
27
27
|
|
28
28
|
if args == render_str?(node)
|
29
29
|
node, path = args
|
30
|
-
unless resolve_template(path.to_s)
|
31
|
-
add_offense(node, location: :expression, message: 'Template could not be found')
|
32
|
-
end
|
30
|
+
add_offense(node, location: :expression, message: 'Template could not be found') unless resolve_template(path.to_s)
|
33
31
|
elsif pairs == render_options?(node)
|
34
32
|
if pair == pairs.detect { |p| render_key?(p) }
|
35
33
|
key, node, path = render_key?(pair)
|
36
34
|
|
37
35
|
case key
|
38
36
|
when :action, :template
|
39
|
-
unless resolve_template(path.to_s)
|
40
|
-
add_offense(node, location: :expression, message: 'Template could not be found')
|
41
|
-
end
|
37
|
+
add_offense(node, location: :expression, message: 'Template could not be found') unless resolve_template(path.to_s)
|
42
38
|
when :partial
|
43
|
-
unless resolve_partial(path.to_s)
|
44
|
-
add_offense(node, location: :expression, message: 'Partial template could not be found')
|
45
|
-
end
|
39
|
+
add_offense(node, location: :expression, message: 'Partial template could not be found') unless resolve_partial(path.to_s)
|
46
40
|
end
|
47
41
|
end
|
48
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-scc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- borisding
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -28,22 +28,22 @@ dependencies:
|
|
28
28
|
name: actionview
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.2'
|
34
31
|
- - ">="
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
33
|
+
version: 6.0.0.beta3
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '6.0'
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "~>"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '5.2'
|
44
41
|
- - ">="
|
45
42
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
43
|
+
version: 6.0.0.beta3
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '6.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: erubis
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +112,16 @@ files:
|
|
112
112
|
- guides/rails-controller-render-shorthand.md
|
113
113
|
- guides/rails-render-inline.md
|
114
114
|
- guides/rails-render-literal.md
|
115
|
-
- lib/rubocop/cop/
|
116
|
-
- lib/rubocop/cop/
|
117
|
-
- lib/rubocop/cop/
|
118
|
-
- lib/rubocop/cop/
|
119
|
-
- lib/rubocop/cop/
|
120
|
-
- lib/rubocop/cop/
|
121
|
-
- lib/rubocop/cop/
|
122
|
-
- lib/rubocop/cop/
|
123
|
-
- lib/rubocop/cop/
|
124
|
-
- lib/rubocop/cop/
|
115
|
+
- lib/rubocop/cop/sequoiacap.rb
|
116
|
+
- lib/rubocop/cop/sequoiacap/class_name.rb
|
117
|
+
- lib/rubocop/cop/sequoiacap/default_scope.rb
|
118
|
+
- lib/rubocop/cop/sequoiacap/factory_class_use_string.rb
|
119
|
+
- lib/rubocop/cop/sequoiacap/no_timeout.rb
|
120
|
+
- lib/rubocop/cop/sequoiacap/rails_controller_render_action_symbol.rb
|
121
|
+
- lib/rubocop/cop/sequoiacap/rails_controller_render_literal.rb
|
122
|
+
- lib/rubocop/cop/sequoiacap/rails_controller_render_paths_exist.rb
|
123
|
+
- lib/rubocop/cop/sequoiacap/rails_controller_render_shorthand.rb
|
124
|
+
- lib/rubocop/cop/sequoiacap/simple_modifier_conditional.rb
|
125
125
|
homepage: https://github.com/sequoia-china/rubocop-scc
|
126
126
|
licenses:
|
127
127
|
- MIT
|
@@ -141,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
|
145
|
-
rubygems_version: 2.7.8
|
144
|
+
rubygems_version: 3.0.2
|
146
145
|
signing_key:
|
147
146
|
specification_version: 4
|
148
147
|
summary: RuboCop SCC
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubocop/cop/sequioacap/class_name'
|
4
|
-
require 'rubocop/cop/sequioacap/default_scope'
|
5
|
-
require 'rubocop/cop/sequioacap/factory_class_use_string'
|
6
|
-
require 'rubocop/cop/sequioacap/no_timeout'
|
7
|
-
require 'rubocop/cop/sequioacap/rails_controller_render_action_symbol'
|
8
|
-
require 'rubocop/cop/sequioacap/rails_controller_render_literal'
|
9
|
-
require 'rubocop/cop/sequioacap/rails_controller_render_paths_exist'
|
10
|
-
require 'rubocop/cop/sequioacap/rails_controller_render_shorthand'
|
11
|
-
require 'rubocop/cop/sequioacap/simple_modifier_conditional'
|