Skip to content

Commit

Permalink
Change potentially offensive terminology
Browse files Browse the repository at this point in the history
I think the few places we use the term "whitelist", we really don't need
to. Changing to use "allowed" etc. instead.

RuboCop did similar changes in
rubocop/rubocop#7469.
  • Loading branch information
bquorning committed Nov 5, 2019
1 parent 0036374 commit 9578d90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/rubocop/cop/rspec/rails/http_status.rb
Expand Up @@ -107,15 +107,15 @@ class NumericStyleChecker
MSG = 'Prefer `%<prefer>s` over `%<current>s` ' \
'to describe HTTP status code.'

WHITELIST_STATUS = %i[error success missing redirect].freeze
ALLOWED_STATUSES = %i[error success missing redirect].freeze

attr_reader :node
def initialize(node)
@node = node
end

def offensive?
!node.int_type? && !whitelisted_symbol?
!node.int_type? && !allowed_symbol?
end

def message
Expand All @@ -136,8 +136,8 @@ def symbol
node.value
end

def whitelisted_symbol?
node.sym_type? && WHITELIST_STATUS.include?(node.value)
def allowed_symbol?
node.sym_type? && ALLOWED_STATUSES.include?(node.value)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/rspec/context_wording_spec.rb
Expand Up @@ -76,15 +76,15 @@
context 'when configured' do
let(:cop_config) { { 'Prefixes' => %w[if] } }

it 'finds context without whitelisted prefixes at the beginning' do
it 'finds context without allowed prefixes at the beginning' do
expect_offense(<<-RUBY)
context 'when display name is present' do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Start context description with 'if'.
end
RUBY
end

it 'skips descriptions with whitelisted prefixes at the beginning' do
it 'skips descriptions with allowed prefixes at the beginning' do
expect_no_offenses(<<-RUBY)
context 'if display name is present' do
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rspec/rails/http_status_spec.rb
Expand Up @@ -60,7 +60,7 @@
RUBY
end

it 'does not register an offense when using whitelisted symbols' do
it 'does not register an offense when using allowed symbols' do
expect_no_offenses(<<-RUBY)
it { is_expected.to have_http_status :error }
it { is_expected.to have_http_status :success }
Expand Down

0 comments on commit 9578d90

Please sign in to comment.