salsify_rubocop 0.42.0 → 0.43.0.rc0

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
  SHA1:
3
- metadata.gz: d574fdef745a9e334e55b58c449deb2cb1807cc9
4
- data.tar.gz: dffcaa9c8811f95ee57d170e5724cdbf8543ee46
3
+ metadata.gz: 3d35dc150ae60c726f5588216b66206d7b7e6225
4
+ data.tar.gz: 808d7b6d4fa1b82feb8d756acf7a960e209ea088
5
5
  SHA512:
6
- metadata.gz: 159db8ad25a634d544070cac994477049711ac2409dbd339b04b8cf86942976df9892a2785bf8ef0a6a0bd13777ab386c6422e0cdbee23fe81f7ae7bc76fb6f3
7
- data.tar.gz: 4cab967d8390bb8bced638ea4e9b9e7b42ef6ddc6532e48555fb14d067b04a59d7e4b15c58fd09202968f29c0e6b902a2035d77b4157c82108c20af16bf965e7
6
+ metadata.gz: e17e1aa6e2acdb63655bf248229b9d17a92802727c9ca98af3f10403bd42fce70dc67411e97e9fa5e85f6f2973da6b2c37b599c443853995cd207e3e8b6fa456
7
+ data.tar.gz: f5477389cbff844b981692f63835db07b71dca7bb0d5681abf0dfbbc876cfea3886c6530f9a4854c14797d172442dbd620b7fb40908ea803f0a622639872ff9e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # salsify_rubocop
2
2
 
3
+ ## v0.43.0
4
+ - Update to `rubocop` v0.43.0.
5
+ - Update to `rubocop-rspec` v1.7.0.
6
+ - Disable new RSpec cops: `LeadingSubject`, `LetSetup`, `MultipleExpectations`,
7
+ and `NestedGroups`.
8
+ - Disable new cop `RSpec/ExpectActual` for routing specs.
9
+ - Disable problematic cops `Style/NumericPredicate`, `Style/SafeNavigation`,
10
+ and `Style/VariableNumber`.
11
+ - Disable `Style/IndentHash`, which applies to the first line, since we are not
12
+ using `Style/AlignHash`.
13
+ - Add `Salsify/RspecStringLiterals` cop to check non-doc string quotes for
14
+ examples/example groups.
15
+ - Modify `Salsify/RspecDocString` to treat names for shared groups and shared
16
+ example as doc strings.
17
+
3
18
  ## v0.42.0
4
19
  - Update to RuboCop v0.42.
5
20
  - Add `Salsify/RspecDocString` cop to check quoting for examples/example groups.
data/conf/rubocop.yml CHANGED
@@ -3,11 +3,6 @@ inherit_from:
3
3
 
4
4
  require: salsify_rubocop
5
5
 
6
- # See https://github.com/bbatsov/rubocop/pull/3343
7
- Style/NumericPredicate:
8
- Exclude:
9
- - 'spec/**/*'
10
-
11
6
  RSpec/DescribeClass:
12
7
  Enabled: false
13
8
 
@@ -20,5 +15,22 @@ RSpec/DescribeMethod:
20
15
  RSpec/ExampleLength:
21
16
  Enabled: false
22
17
 
18
+ # See https://github.com/backus/rubocop-rspec/issues/198
19
+ RSpec/ExpectActual:
20
+ Exclude:
21
+ - 'spec/routing/**/*'
22
+
23
23
  RSpec/InstanceVariable:
24
24
  Enabled: false
25
+
26
+ RSpec/LeadingSubject:
27
+ Enabled: false
28
+
29
+ RSpec/LetSetup:
30
+ Enabled: false
31
+
32
+ RSpec/MultipleExpectations:
33
+ Enabled: false
34
+
35
+ RSpec/NestedGroups:
36
+ Enabled: false
@@ -58,6 +58,10 @@ Style/FrozenStringLiteralComment:
58
58
  Style/GuardClause:
59
59
  Enabled: false
60
60
 
61
+ # does not make sense to enable this without AlignHash
62
+ Style/IndentHash:
63
+ Enabled: false
64
+
61
65
  Style/Lambda:
62
66
  Enabled: false
63
67
 
@@ -77,6 +81,10 @@ Style/MultilineBlockLayout:
77
81
  Style/NumericLiteralPrefix:
78
82
  Enabled: false
79
83
 
84
+ # This cop is problematic when nil may be compared with 0.
85
+ Style/NumericPredicate:
86
+ Enabled: false
87
+
80
88
  Style/Proc:
81
89
  Enabled: false
82
90
 
@@ -86,6 +94,9 @@ Style/RaiseArgs:
86
94
  Style/RegexpLiteral:
87
95
  Enabled: false
88
96
 
97
+ Style/SafeNavigation:
98
+ Enabled: false
99
+
89
100
  # This cop doesn't work properly if you a have a block with
90
101
  # arguments split across multiple lines
91
102
  Style/SpaceAroundBlockParameters:
@@ -99,6 +110,9 @@ Style/StringLiterals:
99
110
  Exclude:
100
111
  - 'spec/**/*'
101
112
 
113
+ Style/VariableNumber:
114
+ Enabled: false
115
+
102
116
  Metrics/AbcSize:
103
117
  Enabled: false
104
118
 
data/config/default.yml CHANGED
@@ -7,3 +7,14 @@ Salsify/RspecDocString:
7
7
  - double_quotes
8
8
  Include:
9
9
  - 'spec/**/*'
10
+
11
+ Salsify/RspecStringLiterals:
12
+ Description: 'Enforce consistent quote style for non-doc strings in RSpec tests.'
13
+ Enabled: true
14
+ EnforcedStyle: single_quotes
15
+ SupportedStyles:
16
+ - single_quotes
17
+ - double_quotes
18
+ # Include:
19
+ # - 'spec/**/*'
20
+
@@ -30,13 +30,14 @@ module RuboCop
30
30
  DOUBLE_QUOTE_MSG =
31
31
  'Example Group/Example doc strings must be double-quoted.'.freeze
32
32
 
33
- DOCUMENTED_METHODS = [
34
- :example_group, :describe, :context, :xdescribe, :xcontext,
35
- :it, :example, :specify, :xit, :xexample, :xspecify,
36
- :feature, :scenario, :xfeature, :xscenario,
37
- :fdescribe, :fcontext, :focus, :fexample, :fit, :fspecify,
38
- :ffeature, :fscenario
39
- ].to_set.freeze
33
+ SHARED_EXAMPLES = RuboCop::RSpec::Language::SelectorSet.new(
34
+ %i(include_examples it_behaves_like it_should_behave_like include_context)
35
+ ).freeze
36
+
37
+ DOCUMENTED_METHODS = (RuboCop::RSpec::Language::ExampleGroups::ALL +
38
+ RuboCop::RSpec::Language::Examples::ALL +
39
+ RuboCop::RSpec::Language::SharedGroups::ALL +
40
+ SHARED_EXAMPLES).freeze
40
41
 
41
42
  def on_send(node)
42
43
  _receiver, method_name, *args = *node
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module RuboCop
5
+ module Cop
6
+ module Salsify
7
+
8
+ # This cop checks if quotes match the configured preference. It is
9
+ # intended to be use specifically for specs and in combination with
10
+ # Salsify/RspecDocString.
11
+ #
12
+ # Used together with Salsify/RspecDocString it allows one quote style to
13
+ # be used for doc strings (`describe "foobar"`) and another style to be
14
+ # used for all other strings in specs.
15
+ class RspecStringLiterals < Cop
16
+ include ConfigurableEnforcedStyle
17
+ include StringLiteralsHelp
18
+
19
+ DOCUMENTED_METHODS = RuboCop::Cop::Salsify::RspecDocString::DOCUMENTED_METHODS
20
+
21
+ SINGLE_QUOTE_MSG = 'Prefer single-quoted strings unless you need ' \
22
+ 'interpolation or special symbols.'.freeze
23
+ DOUBLE_QUOTE_MSG = 'Prefer double-quoted strings unless you need ' \
24
+ 'single quotes to avoid extra backslashes for escaping.'.freeze
25
+
26
+ private
27
+
28
+ def message(*)
29
+ style == :single_quotes ? SINGLE_QUOTE_MSG : DOUBLE_QUOTE_MSG
30
+ end
31
+
32
+ # Share implementation with Style/StringLiterals from rubocop
33
+ def offense?(node)
34
+ return false if documented_parent?(node)
35
+ return false if inside_interpolation?(node)
36
+
37
+ wrong_quotes?(node)
38
+ end
39
+
40
+ def documented_parent?(node)
41
+ parent = node.parent
42
+ parent && parent.send_type? &&
43
+ DOCUMENTED_METHODS.include?(parent.children[1])
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ # Monkey-patch SelectorSet to allow enumeration of selectors.
2
+
3
+ module RuboCop
4
+ module RSpec
5
+ module Language
6
+ class SelectorSet
7
+ def each(&blk)
8
+ selectors.each(&blk)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module SalsifyRubocop
2
- VERSION = '0.42.0'.freeze
2
+ VERSION = '0.43.0.rc0'.freeze
3
3
  end
@@ -14,3 +14,4 @@ RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
14
14
 
15
15
  # cops
16
16
  require 'rubocop/cop/salsify/rspec_doc_string'
17
+ require 'rubocop/cop/salsify/rspec_string_literals'
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rake', '~> 10.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.0'
35
35
 
36
- spec.add_runtime_dependency 'rubocop', '~> 0.42.0'
37
- spec.add_runtime_dependency 'rubocop-rspec', '~> 1.5.1'
36
+ spec.add_runtime_dependency 'rubocop', '~> 0.43.0'
37
+ spec.add_runtime_dependency 'rubocop-rspec', '~> 1.7.0'
38
38
  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.42.0
4
+ version: 0.43.0.rc0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.42.0
61
+ version: 0.43.0
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.42.0
68
+ version: 0.43.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.5.1
75
+ version: 1.7.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.5.1
82
+ version: 1.7.0
83
83
  description: Shared shared RuboCop configuration
84
84
  email:
85
85
  - engineering@salsify.com
@@ -103,6 +103,8 @@ files:
103
103
  - conf/rubocop_without_rspec.yml
104
104
  - config/default.yml
105
105
  - lib/rubocop/cop/salsify/rspec_doc_string.rb
106
+ - lib/rubocop/cop/salsify/rspec_string_literals.rb
107
+ - lib/rubocop/rspec/language/each_selector.rb
106
108
  - lib/salsify_rubocop.rb
107
109
  - lib/salsify_rubocop/version.rb
108
110
  - salsify_rubocop.gemspec
@@ -122,12 +124,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
124
  version: '0'
123
125
  required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  requirements:
125
- - - ">="
127
+ - - ">"
126
128
  - !ruby/object:Gem::Version
127
- version: '0'
129
+ version: 1.3.1
128
130
  requirements: []
129
131
  rubyforge_project:
130
- rubygems_version: 2.5.1
132
+ rubygems_version: 2.6.6
131
133
  signing_key:
132
134
  specification_version: 4
133
135
  summary: Shared shared RuboCop configuration