rubocop-flexport 0.8.0 → 0.9.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: 46325f36546cf5f9699b05f0e921a74a35637ff273508dd089edc74351295f80
4
- data.tar.gz: b9bbdfd40c25d9ba9523b6e317c7ec89a9394cec7ffde496264096ce70237467
3
+ metadata.gz: 611e7d0841b96380210c5b9c0e69e1faa39714f485c7534a3c99f55a9567a854
4
+ data.tar.gz: 0300627c5f7459c722941ce9f7bf6bf594cbb8c6eb6a1e26791ceeeff8651f86
5
5
  SHA512:
6
- metadata.gz: 43c422a8725dfe88de02a0f422f0ae63e5c0faa335e6fbb291c71123a5232702ff0bb8ab955a15a6c765d94baae64ad2a4a011f6b4babf3108e8068af12512ba
7
- data.tar.gz: e04ca19560e033f6fe541489c33a57cb4da52b809a6f85eef06aa9426519537d76486f96203ea80ded0b2f8e6ddb8fcd9c963a74333c72988470a4600c9407f7
6
+ metadata.gz: b23d6b05fe8ad73bd029a38b2fa9c5e957ac50433510e0b7f4b37ee94b1ac3148b8f477a4de297c194fc7f136d40168182f1c0a1442218e27aa9070b60c20e5c
7
+ data.tar.gz: 0b855624ddcfae29e8d211a2e05e54d401a0d06cbfd5e4a118ad6a3bccef1200e409d22f35380cbbf44ec3fc180ed99b34111978042437674675d30e864c651c
data/README.md CHANGED
@@ -43,7 +43,7 @@ like below and then run `bundle install`:
43
43
  gem "rubocop-flexport", path: "/Users/<user>/rubocop-flexport"
44
44
  ```
45
45
 
46
- To release a new version, update the version number in `version.rb`, and then
46
+ To release a new version, update the version number in `lib/rubocop/flexport/version.rb`, and then
47
47
  run `bundle exec rake release`, which will create a git tag for the version,
48
48
  push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
49
 
@@ -17,7 +17,7 @@ module RuboCop
17
17
  # will be accessible outside your engine. For example, adding
18
18
  # `api/foo_service.rb` will allow code outside your engine to
19
19
  # invoke eg `MyEngine::Api::FooService.bar(baz)`.
20
- # - Create a `_whitelist.rb` file in `api/`. Modules listed in
20
+ # - Create an `_allowlist.rb` or `_whitelist.rb` file in `api/`. Modules listed in
21
21
  # this file are accessible to code outside the engine. The file
22
22
  # must have this name and a particular format (see below).
23
23
  #
@@ -268,7 +268,7 @@ module RuboCop
268
268
  (
269
269
  in_legacy_dependent_file?(accessed_engine) ||
270
270
  through_api?(node) ||
271
- whitelisted?(node, accessed_engine)
271
+ allowlisted?(node, accessed_engine)
272
272
  )
273
273
  end
274
274
 
@@ -326,15 +326,16 @@ module RuboCop
326
326
  node.parent&.const_type? && node.parent.children.last == :Api
327
327
  end
328
328
 
329
- def whitelisted?(node, engine)
330
- whitelist = read_api_file(engine, :whitelist)
331
- return false if whitelist.empty?
329
+ def allowlisted?(node, engine)
330
+ allowlist = read_api_file(engine, :allowlist)
331
+ allowlist = read_api_file(engine, :whitelist) if allowlist.empty?
332
+ return false if allowlist.empty?
332
333
 
333
334
  depth = 0
334
335
  max_depth = 5
335
336
  while node.const_type? && depth < max_depth
336
337
  full_const_name = remove_leading_colons(node.source)
337
- return true if whitelist.include?(full_const_name)
338
+ return true if allowlist.include?(full_const_name)
338
339
 
339
340
  node = node.parent
340
341
  depth += 1
@@ -10,9 +10,13 @@ module RuboCop
10
10
  extend NodePattern::Macros
11
11
 
12
12
  API_FILE_DETAILS = {
13
+ allowlist: {
14
+ file_basename: '_allowlist.rb',
15
+ array_matcher: :allowlist_array
16
+ },
13
17
  whitelist: {
14
18
  file_basename: '_whitelist.rb',
15
- array_matcher: :whitelist_array
19
+ array_matcher: :allowlist_array
16
20
  },
17
21
  legacy_dependents: {
18
22
  file_basename: '_legacy_dependents.rb',
@@ -108,7 +112,7 @@ module RuboCop
108
112
  end
109
113
  end
110
114
 
111
- def_node_matcher :whitelist_array, <<-PATTERN
115
+ def_node_matcher :allowlist_array, <<-PATTERN
112
116
  (casgn nil? {:PUBLIC_MODULES :PUBLIC_SERVICES :PUBLIC_CONSTANTS :PUBLIC_TYPES} {$array (send $array ...)})
113
117
  PATTERN
114
118
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Flexport
5
- VERSION = '0.8.0'
5
+ VERSION = '0.9.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-flexport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flexport Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-08 00:00:00.000000000 Z
11
+ date: 2020-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport