gl_rubocop 0.3.0 → 0.3.1

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: cfa3a041b813576c82945878a3a5b712cddc171ee7e490a562c8186c8a078122
4
- data.tar.gz: 59c4a3a19c71605f920bb21ca0b76ef965385e94836d8965b9735164cf227b7c
3
+ metadata.gz: 41e19e076964ffc1a05ef167302c8bafae7cb60d1ea97eda7aed7d1d18dc1f9a
4
+ data.tar.gz: 255a28e9d265048423bb9d8b6631df100e9323a69a2396efe2a7ce4f3d725969
5
5
  SHA512:
6
- metadata.gz: 240a0d83e8b317ef314783c0ff96c3f56cc1af17f144dda86d9048d791ecadb41d3408776831a5130ea8396467def9d65d524c778846539f32828565a742d2cc
7
- data.tar.gz: d4870f2db16c75c7843df195c9a4f0a3b96e412ffedd20489368e7ad634a46933253ee56bd0f61f649edd35465b997d561d2f20618e8b1bcabae2977e7a1bcfe
6
+ metadata.gz: 17ba3a6abd931a45acf825da8a91dba45a0c267b881dc1b0d023991909e85594e58b74922c5204e4f39e306b74458cd28843edbbcee02b15918be67000d9c3b1
7
+ data.tar.gz: 3ffec237316d0fd6f301465a3bbd7d67f4ce2b80ec71b2a8d36e086c77d7c41a04a5a1f9b42c47374fece9fccd07b01f7e2fbe1ad03459f819eaeadfc23ba9cc
@@ -4,20 +4,15 @@ module GLRubocop
4
4
  # This cop ensures that view components include a data-test-id attribute.
5
5
  #
6
6
  # Good:
7
- # {data-test-id: 'unique-id'}
8
- # {data-test-id: @unique_id }
9
- # {'data-test-id': 'unique-id'}
10
- # {"data-test-id": "unique-id"}
11
- # {data: {test-id: 'unique-id'}}
12
- # {data: {'test-id': 'unique-id'}}
7
+ # data-test-id="unique-id"
13
8
  #
14
9
  # Bad:
15
- # {data: {testId: "unique-id"}}
16
- # {data: {test: {id: "unique-id"}}
17
-
10
+ # data-testid="unique-id"
11
+ # data-testId="unique-id"
12
+ # data-test_id="unique-id"
18
13
  MSG = 'View components must include a data-test-id attribute'.freeze
19
14
  EMPTY_MSG = 'data-test-id attribute must not be empty'.freeze
20
- UNIQUE_IDENTIFIER = 'test-id'.freeze
15
+ UNIQUE_IDENTIFIER = 'data-test-id='.freeze
21
16
 
22
17
  def on_send(node)
23
18
  return unless file_exists? && valid_method_name?(node)
@@ -42,18 +37,12 @@ module GLRubocop
42
37
  @raw_content ||= File.read(processed_source.file_path)
43
38
  end
44
39
 
45
- def regex_for_indentifier_and_value
46
- key = Regexp.quote(UNIQUE_IDENTIFIER)
47
- /(?:["']?data-#{key}["']?|data:.?\{["']?#{key}["']?):\s*(["']([^"']*)["']|@\w+)/
48
- end
49
-
50
40
  def test_id_value
51
- match = identifiable_line.match(regex_for_indentifier_and_value)
41
+ str_match = identifiable_line[/data-test-id=('|")[^'|"]*/]
52
42
 
53
- return '' unless match
43
+ return '' unless str_match
54
44
 
55
- value = match[1]
56
- value.start_with?('"', "'") ? value[1..-2] : value
45
+ str_match.gsub(/data-test-id=./, '')
57
46
  end
58
47
 
59
48
  def valid_method_name?(node)
@@ -1,3 +1,3 @@
1
1
  module GLRubocop
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gl_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Give Lively
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-31 00:00:00.000000000 Z
11
+ date: 2025-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop