rubocop-dependency 0.1.2 → 0.2.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: 7bdeb2c962a35bae787df85079409fb708f9dca68f4e04710df43d30565649a7
4
- data.tar.gz: 6e9f3bfd975008e1ff78b4b1913e4ef440053dcbcd652e3acb426e1d6f048c77
3
+ metadata.gz: bbf1b624216ceee7dd7b2b25a407cace73538a8cbaf9be1eb1a38b6c59691893
4
+ data.tar.gz: d843b719eea3f148c8fee2f9fa484a21a2c904a982e008f666f9cf96dd0d3bcf
5
5
  SHA512:
6
- metadata.gz: cba1ae758b36e3dee42c4168b4d46caa7e724400cf91c8a41fba5c57e9988d5593438b744406af215f2afb94bf2e8af27b711ba6b2c9bcb6bd4ec0afe34cb903
7
- data.tar.gz: 425d513994495296dcfa23d6d44731a05793b77afea6972fb801a83ab5f11cb334d734af097cc9acfaa10f8bcce78b6db599b98970e98ccb242d011b0fa79127
6
+ metadata.gz: 7f34d8be696624921aab680434d1a180431577a083860823e352dd4179e4a0515134d40e09f6fd13cfb112f97a974be2b134e60c09ba394f713f0bd8412748f6
7
+ data.tar.gz: '056538df68f3fcf8603ecf041801686e0cb1065e656fa5f274223fc13d6947aa7c04dfef8ba26fb122b54fdcd4b289a5d835cd4aaf1d2d649a836f5d0f8349eb'
data/README.md CHANGED
@@ -29,9 +29,9 @@ Check not to refer constants over dependency boundaries which given from `Rules`
29
29
  When the following `Rules` is given,
30
30
 
31
31
  ```yaml
32
- Rules: # Array of each rules
33
- - BannedConsts: Foo # Array<String> | String.
34
- FromNamespacePatterns: # Array<String> | String. This value is used as Regexp pattern.
32
+ Rules: # Array of each rules
33
+ - BannedConstPatterns: Foo # Array<String> | String. This value is used as Regexp pattern.
34
+ FromNamespacePatterns: # Array<String> | String. This value is used as Regexp pattern.
35
35
  - \ABar(\W|\z)
36
36
  ```
37
37
 
@@ -7,7 +7,7 @@ module RuboCop
7
7
  #
8
8
  # @example
9
9
  # # Rules:
10
- # # - BannedConsts: Foo
10
+ # # - BannedConstPatterns: Foo
11
11
  # # FromNamespacePatterns:
12
12
  # # - \ABar(\W|\z)
13
13
  #
@@ -18,6 +18,8 @@ module RuboCop
18
18
  #
19
19
  class OverBoundary < Base
20
20
  def on_const(node)
21
+ return if node.parent&.const_type?
22
+
21
23
  const_name = node.const_name
22
24
  current_namespace =
23
25
  node
@@ -27,7 +29,9 @@ module RuboCop
27
29
 
28
30
  if cop_config['Rules']
29
31
  .select { |rule|
30
- Array(rule['BannedConsts']).include?(const_name)
32
+ Array(rule['BannedConstPatterns']).any? { |banned_pattern|
33
+ Regexp.new(banned_pattern).match?(const_name)
34
+ }
31
35
  }
32
36
  .any? { |rule|
33
37
  Array(rule['FromNamespacePatterns']).any? { |from_pattern|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Dependency
5
- VERSION = "0.1.2"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-dependency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KATO Kei
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2025-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -118,7 +118,7 @@ metadata:
118
118
  homepage_uri: https://github.com/keik/rubocop-dependency
119
119
  source_code_uri: https://github.com/keik/rubocop-dependency
120
120
  changelog_uri: https://github.com/keik/rubocop-dependency/CHANGELOG.md
121
- post_install_message:
121
+ post_install_message:
122
122
  rdoc_options: []
123
123
  require_paths:
124
124
  - lib
@@ -133,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 3.0.3
137
- signing_key:
136
+ rubygems_version: 3.4.19
137
+ signing_key:
138
138
  specification_version: 4
139
139
  summary: Code style checking for dependencies control.
140
140
  test_files: []