rubocop-betterment 1.16.0 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/cop/betterment.rb +1 -0
- data/lib/rubocop/cop/betterment/allowlist_blocklist.rb +38 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8239d7858cb48ea9f9d93ee9f84ad1619b85eba879b9d426ee6170013b8fa822
|
4
|
+
data.tar.gz: b3543e852dd249fa2be8ee46d12a8742a2c9de750a1a77847a7a22cb4c47a98b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2195af7a4f7c629cfee631d365854d507791fa5aa96fbdcbcbab0dadb6e0d70f13c6908fd5949ba3be565527098a37112cdc55dc8dd1b1b13664c3f489d9298
|
7
|
+
data.tar.gz: 5cda689379c9b1ba9d5508120b0a6479a73f06f158273ef67b0039e64f7c56a2199f23658204b3c873f2623b99f2d54580cf930e51002a84addc8767805134d6
|
@@ -9,3 +9,4 @@ require 'rubocop/cop/betterment/site_prism_loaded'
|
|
9
9
|
require 'rubocop/cop/betterment/spec_helper_required_outside_spec_dir'
|
10
10
|
require 'rubocop/cop/betterment/implicit_redirect_type'
|
11
11
|
require 'rubocop/cop/betterment/active_job_performable'
|
12
|
+
require 'rubocop/cop/betterment/allowlist_blocklist'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# rubocop:disable Betterment/AllowlistBlocklist
|
2
|
+
module RuboCop
|
3
|
+
module Cop
|
4
|
+
module Betterment
|
5
|
+
class AllowlistBlocklist < Cop
|
6
|
+
MSG = <<-DOC.freeze
|
7
|
+
Betterment has moved away from usages of whitelist & blacklist in favor of more inclusive terms.
|
8
|
+
Replace any instances of these terms with more inclusive terms like allowlist, blocklist, denylist,
|
9
|
+
ignorelist, warnlist, safelist, etc. We generally use allowlist and blocklist and prefer consistency where
|
10
|
+
possible, but other terms may be more appropriate depending on your use case.
|
11
|
+
|
12
|
+
This is part of a larger initiative to replace exclusionary / harmful language and anti-bias tools and products.
|
13
|
+
DOC
|
14
|
+
|
15
|
+
def on_class(node)
|
16
|
+
evaluate_node(node)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def evaluate_node(node)
|
22
|
+
return unless should_use_allowlist?(node) || should_use_blocklist?(node)
|
23
|
+
|
24
|
+
add_offense(node, message: MSG)
|
25
|
+
end
|
26
|
+
|
27
|
+
def should_use_allowlist?(node)
|
28
|
+
node.to_s.downcase.include?('whitelist')
|
29
|
+
end
|
30
|
+
|
31
|
+
def should_use_blocklist?(node)
|
32
|
+
node.to_s.downcase.include?('blacklist')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
# rubocop:enable Betterment/AllowlistBlocklist
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-betterment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- config/default.yml
|
93
93
|
- lib/rubocop/cop/betterment.rb
|
94
94
|
- lib/rubocop/cop/betterment/active_job_performable.rb
|
95
|
+
- lib/rubocop/cop/betterment/allowlist_blocklist.rb
|
95
96
|
- lib/rubocop/cop/betterment/authorization_in_controller.rb
|
96
97
|
- lib/rubocop/cop/betterment/dynamic_params.rb
|
97
98
|
- lib/rubocop/cop/betterment/implicit_redirect_type.rb
|