rubocop-scc 0.2.2 → 1.0.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: 78494b0a918b525ad912cda5e333c3cda12f328b9a318a6c97929e563311db61
4
- data.tar.gz: b369263e3fe3c0a7a03e59f62ff712726bca05cc9f3aa52c4c66810e50bba08a
3
+ metadata.gz: f00c8d00c7989c4142a2127787fbdd4563f9cfb9ce599f4acae514a41fa341b9
4
+ data.tar.gz: 37e75c158ee38448769e28d1b4b51d2bbcb41cb9194034b5467a793ed170eef3
5
5
  SHA512:
6
- metadata.gz: b27de17b481f3d9a512919cfad59059b06ffde9ec0982e80c246b15816866f05196da4cb8d158d6ce87579b3cca94aa041d02d5be9a37927acb59b348ff774b6
7
- data.tar.gz: 91d161c566f0a557b8d26aa13525b69f0cfe0faf0363b1c75f74c790e3b2a8676d361def26ae099112b76df07e85f3b741178aeba340be20382cd718b3f39816
6
+ metadata.gz: 5b31efdd916434ac19a15058ebf1e22998f5915d4b617a8c99f2df1ed211b41e0ac929a5206b28947eb32a4a09aea72a22ead324477a06ca3e36d54c181340b5
7
+ data.tar.gz: 72ef8bc1f2949688b254b1db56c32bd907e9d327722f5534d1e0aab3378468bb181e82d4b660aa7ca3ade30bed853d85c739448f9af046321204c95245836996
data/config/default.yml CHANGED
@@ -585,7 +585,7 @@ Style/InfiniteLoop:
585
585
  Enabled: true
586
586
 
587
587
  Style/InlineComment:
588
- Enabled: true
588
+ Enabled: false
589
589
 
590
590
  Style/MethodMissingSuper:
591
591
  Enabled: true
data/config/rails.yml CHANGED
@@ -1,4 +1,4 @@
1
- require: rubocop/cop/sequioacap
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
- Sequioacap/RailsControllerRenderActionSymbol:
101
+ sequoiacap/RailsControllerRenderActionSymbol:
102
102
  Enabled: true
103
103
  Include:
104
104
  - 'app/controllers/**/*.rb'
105
105
 
106
- Sequioacap/RailsControllerRenderLiteral:
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
- Sequioacap/RailsControllerRenderPathsExist:
113
- Enabled: true
112
+ sequoiacap/RailsControllerRenderPathsExist:
113
+ Enabled: false
114
114
  ViewPath:
115
115
  - 'app/views'
116
116
  Include:
117
117
  - 'app/controllers/**/*.rb'
118
118
 
119
- Sequioacap/RailsControllerRenderShorthand:
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
- Sequioacap/ClassName:
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
- Sequioacap/DefaultScope:
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
- Sequioacap/FactoryClassUseString:
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
- Sequioacap/NoTimeout:
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
- Sequioacap/SimpleModifierConditional:
149
+ sequoiacap/SimpleModifierConditional:
150
150
  Enabled: true
151
151
  StyleGuide: https://github.com/airbnb/ruby#only-simple-if-unless
152
152
 
@@ -1,4 +1,4 @@
1
- # Sequioacap/RailsControllerRenderShorthand
1
+ # sequoiacap/RailsControllerRenderShorthand
2
2
 
3
3
  Prefer `render "path/to/template"` shorthand in controllers.
4
4
 
@@ -1,4 +1,4 @@
1
- # Sequioacap/RailsRenderInline
1
+ # sequoiacap/RailsRenderInline
2
2
 
3
3
  tldr; Do not use `render inline:`.
4
4
 
@@ -1,4 +1,4 @@
1
- # Sequioacap/RailsRenderLiteral
1
+ # sequoiacap/RailsRenderLiteral
2
2
 
3
3
  tldr; `render` MUST be passed a string literal template path.
4
4
 
@@ -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 Sequioacap
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 Sequioacap
7
+ module Sequoiacap
8
8
  # Cop to help prevent the scorge of Default Scopes from ActiveRecord.
9
9
  # Once in place they are almost impossible to remove.
10
10
  class DefaultScope < Cop
@@ -4,7 +4,7 @@ require 'rubocop'
4
4
 
5
5
  module RuboCop
6
6
  module Cop
7
- module Sequioacap
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 Sequioacap
7
+ module Sequoiacap
8
8
  class NoTimeout < Cop
9
9
  MSG =
10
10
  'Do not use Timeout.timeout. In combination with Rails autoloading, ' \
@@ -4,7 +4,7 @@ require 'rubocop'
4
4
 
5
5
  module RuboCop
6
6
  module Cop
7
- module Sequioacap
7
+ module Sequoiacap
8
8
  class RailsControllerRenderActionSymbol < Cop
9
9
  MSG = 'Prefer `render` with string instead of symbol'
10
10
 
@@ -4,7 +4,7 @@ require 'rubocop'
4
4
 
5
5
  module RuboCop
6
6
  module Cop
7
- module Sequioacap
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 Sequioacap
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
@@ -4,7 +4,7 @@ require 'rubocop'
4
4
 
5
5
  module RuboCop
6
6
  module Cop
7
- module Sequioacap
7
+ module Sequoiacap
8
8
  class RailsControllerRenderShorthand < Cop
9
9
  MSG = 'Prefer `render` template shorthand'
10
10
 
@@ -4,7 +4,7 @@ require 'rubocop'
4
4
 
5
5
  module RuboCop
6
6
  module Cop
7
- module Sequioacap
7
+ module Sequoiacap
8
8
  # Cop to tackle prevent more complicated modifier if/unless statements
9
9
  # https://github.com/airbnb/ruby#only-simple-if-unless
10
10
  class SimpleModifierConditional < Cop
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.2.2
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: 2018-12-11 00:00:00.000000000 Z
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: 5.2.2
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: 5.2.2
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/sequioacap.rb
116
- - lib/rubocop/cop/sequioacap/class_name.rb
117
- - lib/rubocop/cop/sequioacap/default_scope.rb
118
- - lib/rubocop/cop/sequioacap/factory_class_use_string.rb
119
- - lib/rubocop/cop/sequioacap/no_timeout.rb
120
- - lib/rubocop/cop/sequioacap/rails_controller_render_action_symbol.rb
121
- - lib/rubocop/cop/sequioacap/rails_controller_render_literal.rb
122
- - lib/rubocop/cop/sequioacap/rails_controller_render_paths_exist.rb
123
- - lib/rubocop/cop/sequioacap/rails_controller_render_shorthand.rb
124
- - lib/rubocop/cop/sequioacap/simple_modifier_conditional.rb
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
- rubyforge_project:
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'