umbrellio-utils 1.10.2 → 1.11.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: 1ac66e89e54bb22d976a606f383830bcba7a9599257534ae9925d3c0ca230ba6
4
- data.tar.gz: c636082cfe9ab5bdb54bafa4ede07d5d5ec68d3804f43d66763dce98e6c3d6c1
3
+ metadata.gz: 9165c91dbb79ad43e8cc63d58789550589b944273762b32a813f07ed7efab1e7
4
+ data.tar.gz: 28e172b27fb9d9bedae987ba17e58767985b4860322e1b07c3824b53de4822e4
5
5
  SHA512:
6
- metadata.gz: ec252ec6f68e109429c5c489446dc1cc86629ebe9461e59cd12974f0311720313424ff0962d7dec70221d3bd0ae50c1b48c6cdda9c569d31d33bcac0736245c7
7
- data.tar.gz: 030312f8ef0bfd6a11dd5bead2ceb018aa0dd021dcd8c7ace71c3b5dee92c96927fd0c3594730167b794ec4d49de72a7a56f516978c7da05e9d1b431109da85b
6
+ metadata.gz: a834763488ba0b1573dcdd1d927ff1997fa9a45021d71501b053243a33d7a6344e4d42a1dd286238fbd36d7be49532a960842f2e3d33a8d687cf344ca80b6a48
7
+ data.tar.gz: 998d29af9ea53290721abbe8f675c1084722450731da4e0f3e0faa9960deb51b30dde2678eca2aa02067527b8f47ea280188fefa0b778e39a2764fb3c5d76583
data/Gemfile.lock CHANGED
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- umbrellio-utils (1.10.2)
13
+ umbrellio-utils (1.11.0)
14
14
  memery (~> 1)
15
15
 
16
16
  GEM
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Custom
6
+ class RegexRules < Base
7
+ def on_new_investigation
8
+ return if processed_source.blank?
9
+
10
+ rules.each do |rule|
11
+ next unless applies_to_file?(rule)
12
+
13
+ regex = Regexp.new(rule["regex"])
14
+ processed_source.raw_source.each_line.with_index(1) do |line, lineno|
15
+ next unless (match = regex.match(line))
16
+
17
+ range = range_for_match(lineno, match)
18
+ add_offense(range, message: rule["message"])
19
+ end
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def rules
26
+ cop_config["Rules"] || []
27
+ end
28
+
29
+ def applies_to_file?(rule)
30
+ path = processed_source.path.sub("#{Dir.pwd}/", "") # relative path
31
+
32
+ # Check exclusions first
33
+ if rule["exclude_paths"]&.any? do |pattern|
34
+ File.fnmatch?(pattern, path)
35
+ end
36
+ return false
37
+ end
38
+
39
+ # Then check inclusions
40
+ return true unless rule["paths"] # no restriction
41
+
42
+ rule["paths"].any? { |pattern| File.fnmatch?(pattern, path, File::FNM_PATHNAME) }
43
+ end
44
+
45
+ def range_for_match(lineno, match)
46
+ buffer = processed_source.buffer
47
+ line_range = buffer.line_range(lineno)
48
+ start_pos = line_range.begin_pos + match.begin(0)
49
+ end_pos = line_range.begin_pos + match.end(0)
50
+ Parser::Source::Range.new(buffer, start_pos, end_pos)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "umbrellio_utils/rubocop/cop/custom/regex_rules"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UmbrellioUtils
4
- VERSION = "1.10.2"
4
+ VERSION = "1.11.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Umbrellio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-13 00:00:00.000000000 Z
11
+ date: 2026-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memery
@@ -64,6 +64,8 @@ files:
64
64
  - lib/umbrellio_utils/random.rb
65
65
  - lib/umbrellio_utils/request_wrapper.rb
66
66
  - lib/umbrellio_utils/rounding.rb
67
+ - lib/umbrellio_utils/rubocop.rb
68
+ - lib/umbrellio_utils/rubocop/cop/custom/regex_rules.rb
67
69
  - lib/umbrellio_utils/semantic_logger/tiny_json_formatter.rb
68
70
  - lib/umbrellio_utils/sql.rb
69
71
  - lib/umbrellio_utils/store.rb