rubocop-betterment 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfc81280ce15b5ff44ba5f45345bf8ec461c34d4058135b2d86b2bb9a5f48600
4
- data.tar.gz: fc53b65409351b9604cefff382add3a95c09ae5d98d93d3979ac935fee31c4b1
3
+ metadata.gz: 8239d7858cb48ea9f9d93ee9f84ad1619b85eba879b9d426ee6170013b8fa822
4
+ data.tar.gz: b3543e852dd249fa2be8ee46d12a8742a2c9de750a1a77847a7a22cb4c47a98b
5
5
  SHA512:
6
- metadata.gz: cd1bb04b824fbc3386b0ecbe1755820aad68748aa91ad5339a92ceaac2adf08cb4d5cf4cefb7ed94fd972430b359fbb71b924bec0cad14e5d9ec87b7f1d1a96f
7
- data.tar.gz: 96453a9b868b7c492712fdd733f1cf39a11e9c5a42136d663edec81405581eca70f019afca25b3c8a5801a06396379ee204bc8649286608a78322690dae28c3c
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.16.0
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-07-07 00:00:00.000000000 Z
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