salsify_rubocop 0.58.0.rc1 → 0.59.2.1.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87305955e8ac9148e7c0e35f8cb0452574965f0bfc07452e225bb939603c3dc0
4
- data.tar.gz: 622dc482540ce25f41213cacb1a16f08352bfb39ba644478429183cab24b0ead
3
+ metadata.gz: 3bad74d395450e607785a9cce155e9637feda5a809b073c979acc8dbc811bb30
4
+ data.tar.gz: 48029cf2df4a10cdfa5aa82b3a0cec831349820196359f78ac76bd970ede329b
5
5
  SHA512:
6
- metadata.gz: e7a437af5fb882a1ad682038b28352e1ae8271286ca30d939e594b97f660e37c9e0bae2138f1887d28055681b2201184d95d0a868d9570b0171895e53f566150
7
- data.tar.gz: ddcd4352d6689267ced3567a114f0d55da058c673e320425b28d52f15962cd17710b8ec2a9428a1c89628d7466551fa7c52ceb47ee011e6e231f7bbf832471cf
6
+ metadata.gz: 64f196f2442d97efb44df337d1e35ea58860a17909a793d658c65053c8006097a873ace55c7b7bff4d15fe69f0bc358d232ca9568ab465c062a7907af65e9e6b
7
+ data.tar.gz: 64475b91d7e555e2665240d288a9ca043a4ce41177786b64646dbd185c5e17b3a7ed44237064c76e9699784d5b141c93aeef7c157a8250f5c5bf7105dbe8df6e
@@ -1,5 +1,9 @@
1
1
  # salsify_rubocop
2
2
 
3
+ ## v0.59.2.1
4
+ - Update `rubocop` to v0.59.2.
5
+ - Add `Salsify/RailsUnscoped` cop.
6
+
3
7
  ## v0.58.0
4
8
  - Update `rubocop` to v0.58.0.
5
9
  - Update `rubocop-rspec` to v1.29.0.
@@ -17,3 +17,6 @@ Rails/TimeZone:
17
17
 
18
18
  Rails/UniqBeforePluck:
19
19
  EnforcedStyle: aggressive
20
+
21
+ Salsify/RailsUnscoped:
22
+ Enabled: true
@@ -10,6 +10,10 @@ Salsify/RailsApplicationRecord:
10
10
  Description: 'Models must subclass ApplicationRecord.'
11
11
  Enabled: false
12
12
 
13
+ Salsify/RailsUnscoped:
14
+ Description: 'Activerecord scopes cannot use unscoped.'
15
+ Enabled: false
16
+
13
17
  Salsify/RspecDocString:
14
18
  Description: 'Check that RSpec doc strings use the correct quoting.'
15
19
  Enabled: true
@@ -0,0 +1,28 @@
1
+ module RuboCop
2
+ module Cop
3
+ module Salsify
4
+ # Check that Activerecord scopes do not use `unscoped`
5
+ #
6
+ # @example
7
+ #
8
+ # # good
9
+ # User.strip_default_scope
10
+ #
11
+ # # bad
12
+ # User.unscoped
13
+ class RailsUnscoped < Cop
14
+ MSG = 'Explicitly remove scopes instead of using `unscoped`.'.freeze
15
+
16
+ def_node_matcher :unscoped?, <<-PATTERN
17
+ (send _ :unscoped)
18
+ PATTERN
19
+
20
+ def on_send(node)
21
+ return unless unscoped?(node)
22
+
23
+ add_offense(node, location: :expression, message: MSG)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -61,6 +61,7 @@ module RuboCop
61
61
  def wrong_quotes?(node)
62
62
  src = node.source
63
63
  return false if src.start_with?('%', '?')
64
+
64
65
  if style == :single_quotes
65
66
  src !~ /^'/ && !needs_escaping?(node.str_content)
66
67
  else
@@ -29,6 +29,7 @@ module RuboCop
29
29
 
30
30
  def on_send(node)
31
31
  return unless nested_access_match(node) && !assignment?(node)
32
+
32
33
  match_node = node
33
34
  # walk to outermost access node
34
35
  match_node = match_node.parent while access_node?(match_node.parent)
@@ -15,6 +15,7 @@ RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
15
15
  # cops
16
16
  require 'rubocop/cop/salsify/rails_application_mailer'
17
17
  require 'rubocop/cop/salsify/rails_application_serializer'
18
+ require 'rubocop/cop/salsify/rails_unscoped'
18
19
  require 'rubocop/cop/salsify/rspec_doc_string'
19
20
  require 'rubocop/cop/salsify/rspec_dot_not_self_dot'
20
21
  require 'rubocop/cop/salsify/rspec_string_literals'
@@ -1,3 +1,3 @@
1
1
  module SalsifyRubocop
2
- VERSION = '0.58.0.rc1'.freeze
2
+ VERSION = '0.59.2.1.rc1'.freeze
3
3
  end
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'rake', '~> 10.0'
33
33
  spec.add_development_dependency 'rspec', '~> 3.0'
34
34
 
35
- spec.add_runtime_dependency 'rubocop', '~> 0.58.0'
35
+ spec.add_runtime_dependency 'rubocop', '~> 0.59.2'
36
36
  spec.add_runtime_dependency 'rubocop-rspec', '~> 1.29.0'
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salsify_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.58.0.rc1
4
+ version: 0.59.2.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-29 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.58.0
61
+ version: 0.59.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.58.0
68
+ version: 0.59.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +105,7 @@ files:
105
105
  - config/default.yml
106
106
  - lib/rubocop/cop/salsify/rails_application_mailer.rb
107
107
  - lib/rubocop/cop/salsify/rails_application_serializer.rb
108
+ - lib/rubocop/cop/salsify/rails_unscoped.rb
108
109
  - lib/rubocop/cop/salsify/rspec_doc_string.rb
109
110
  - lib/rubocop/cop/salsify/rspec_dot_not_self_dot.rb
110
111
  - lib/rubocop/cop/salsify/rspec_string_literals.rb
@@ -134,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
135
  version: 1.3.1
135
136
  requirements: []
136
137
  rubyforge_project:
137
- rubygems_version: 2.7.7
138
+ rubygems_version: 2.7.6
138
139
  signing_key:
139
140
  specification_version: 4
140
141
  summary: Shared shared RuboCop configuration