Skip to content

Commit 2c7e866

Browse files
authored
Merge pull request #1281 from ydah/add_naming_inclusive_language_rule
Enable `Naming/InclusiveLanguage`
2 parents 17aded3 + 4f40074 commit 2c7e866

File tree

9 files changed

+24
-13
lines changed

9 files changed

+24
-13
lines changed

.rubocop.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ Naming/FileName:
5656
Exclude:
5757
- lib/rubocop-rspec.rb
5858

59+
Naming/InclusiveLanguage:
60+
Enabled: true
61+
CheckStrings: true
62+
FlaggedTerms:
63+
behaviour:
64+
Suggestions:
65+
- behavior
66+
offence:
67+
Suggestions:
68+
- offense
69+
5970
RSpec/ExampleLength:
6071
CountAsOne:
6172
- heredoc

docs/modules/ROOT/pages/cops_rspec.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ let(:foo) { bar }
12081208
Checks for long examples.
12091209

12101210
A long example is usually more difficult to understand. Consider
1211-
extracting out some behaviour, e.g. with a `let` block, or a helper
1211+
extracting out some behavior, e.g. with a `let` block, or a helper
12121212
method.
12131213

12141214
You can set literals you want to fold with `CountAsOne`.
@@ -2380,7 +2380,7 @@ scope, are defined in global namespace, and leak between examples.
23802380

23812381
If several examples may define a `DummyClass`, instead of being a
23822382
blank slate class as it will be in the first example, subsequent
2383-
examples will be reopening it and modifying its behaviour in
2383+
examples will be reopening it and modifying its behavior in
23842384
unpredictable ways.
23852385
Even worse when a class that exists in the codebase is reopened.
23862386

lib/rubocop/cop/rspec/change_by_zero.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ class ChangeByZero < Base
5252

5353
def on_send(node)
5454
expect_change_with_arguments(node.parent) do
55-
check_offence(node.parent)
55+
check_offense(node.parent)
5656
end
5757

5858
expect_change_with_block(node.parent.parent) do
59-
check_offence(node.parent.parent)
59+
check_offense(node.parent.parent)
6060
end
6161
end
6262

6363
private
6464

65-
def check_offence(node)
65+
def check_offense(node)
6666
expression = node.loc.expression
6767
if compound_expectations?(node)
6868
add_offense(expression, message: MSG_COMPOUND)

lib/rubocop/cop/rspec/example_length.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module RSpec
66
# Checks for long examples.
77
#
88
# A long example is usually more difficult to understand. Consider
9-
# extracting out some behaviour, e.g. with a `let` block, or a helper
9+
# extracting out some behavior, e.g. with a `let` block, or a helper
1010
# method.
1111
#
1212
# @example

lib/rubocop/cop/rspec/leaky_constant_declaration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module RSpec
1010
#
1111
# If several examples may define a `DummyClass`, instead of being a
1212
# blank slate class as it will be in the first example, subsequent
13-
# examples will be reopening it and modifying its behaviour in
13+
# examples will be reopening it and modifying its behavior in
1414
# unpredictable ways.
1515
# Even worse when a class that exists in the codebase is reopened.
1616
#

spec/rubocop/cop/rspec/empty_example_group_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@
370370
end
371371
372372
describe Foo do
373-
skip 'undefined behaviour'
373+
skip 'undefined behavior'
374374
end
375375
376376
xdescribe Foo

spec/rubocop/cop/rspec/file_path_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
RUBY
8585
end
8686

87-
it 'does not register an offence for example groups '\
87+
it 'does not register an offense for example groups '\
8888
'do not describe a class / method' do
8989
expect_no_offenses(<<-RUBY, 'some/class/spec.rb')
9090
describe 'Test something' do; end
@@ -184,14 +184,14 @@
184184
RUBY
185185
end
186186

187-
it 'does not register an offence for an arbitrary spec suffix' do
187+
it 'does not register an offense for an arbitrary spec suffix' do
188188
filename = 'some/class/thing_predicate_spec.rb'
189189
expect_no_offenses(<<-RUBY, filename)
190190
describe Some::Class, '#thing?' do; end
191191
RUBY
192192
end
193193

194-
it 'does not register an offence for an arbitrary spec name '\
194+
it 'does not register an offense for an arbitrary spec name '\
195195
'for an operator method' do
196196
filename = 'my_little_class/spaceship_operator_spec.rb'
197197
expect_no_offenses(<<-RUBY, filename)

spec/rubocop/cop/rspec/instance_spy_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
end
4848

4949
context 'when not used with `have_received`' do
50-
it 'does not add an offence' do
50+
it 'does not add an offense' do
5151
expect_no_offenses(<<-RUBY)
5252
it do
5353
foo = instance_double(Foo).as_null_object

spec/rubocop/cop/rspec/leading_subject_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def helper_method
280280
RUBY
281281
end
282282

283-
it 'does not register an offence for subject in arbitrary code' do
283+
it 'does not register an offense for subject in arbitrary code' do
284284
expect_no_offenses(<<-RUBY)
285285
module Support
286286
subject do

0 commit comments

Comments
 (0)