Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb4984f

Browse files
committed
Fix Style/MutableConstant; disable AlignHash
I disagree with the recent changes in AlignHash, so a combination of `key` and `table` styles is no longer allowed. The issue is very well described in rubocop/rubocop#6410 .
1 parent 6deb2b2 commit cb4984f

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.rubocop.yml

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ AllCops:
99
- 'tmp/**/*'
1010
- 'spec/smoke_tests/**/*.rb'
1111

12+
# See https://github.com/rubocop-hq/rubocop/issues/6410
13+
Layout/AlignHash:
14+
Enabled: false
15+
1216
Metrics/BlockLength:
1317
Exclude:
1418
- rubocop-rspec.gemspec

lib/rubocop/cop/rspec/example_wording.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class ExampleWording < Cop
3333
MSG_SHOULD = 'Do not use should when describing your tests.'.freeze
3434
MSG_IT = "Do not repeat 'it' when describing your tests.".freeze
3535

36-
SHOULD_PREFIX = /\Ashould(?:n't)?\b/i
37-
IT_PREFIX = /\Ait /i
36+
SHOULD_PREFIX = /\Ashould(?:n't)?\b/i.freeze
37+
IT_PREFIX = /\Ait /i.freeze
3838

3939
def_node_matcher(
4040
:it_description,

lib/rubocop/rspec/config_formatter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RuboCop
44
module RSpec
55
# Builds a YAML config file from two config hashes
66
class ConfigFormatter
7-
NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)/
7+
NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)/.freeze
88
STYLE_GUIDE_BASE_URL = 'http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/'.freeze
99

1010
def initialize(config, descriptions)

lib/rubocop/rspec/wording.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ module RuboCop
44
module RSpec
55
# RSpec example wording rewriter
66
class Wording
7-
SHOULDNT_PREFIX = /\Ashould(?:n't| not)\b/i
8-
SHOULDNT_BE_PREFIX = /#{SHOULDNT_PREFIX} be\b/i
9-
ES_SUFFIX_PATTERN = /(?:o|s|x|ch|sh|z)\z/i
10-
IES_SUFFIX_PATTERN = /[^aeou]y\z/i
7+
SHOULDNT_PREFIX = /\Ashould(?:n't| not)\b/i.freeze
8+
SHOULDNT_BE_PREFIX = /#{SHOULDNT_PREFIX} be\b/i.freeze
9+
ES_SUFFIX_PATTERN = /(?:o|s|x|ch|sh|z)\z/i.freeze
10+
IES_SUFFIX_PATTERN = /[^aeou]y\z/i.freeze
1111

1212
def initialize(text, ignore:, replace:)
1313
@text = text

0 commit comments

Comments
 (0)