judgelint 0.1.6 → 0.1.7

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: '0901cbb02b6850e8d11760748b1ae734629b06d12ad019af3eab4d255f689761'
4
- data.tar.gz: 468268468e35d1e9f9274281a3184de02ccfff98080c99c47b0ec6349f9a5762
3
+ metadata.gz: 6dcc0a70019bd3dda62fe68777bf2ca2f76a79b5bef25d1d7bd5b6c9776a592c
4
+ data.tar.gz: 15445873a65cdf4460e51a432b5f89023f391031a4f41fcd6ddcd15e4bb9fafc
5
5
  SHA512:
6
- metadata.gz: 85868cd486ebdaf2663607f2539c58541b59150da14eab77ee23fc950878aa9c466eef90cab29ea3241d520d74bebb88803c99b4b31dd0ad979be65187b9da9d
7
- data.tar.gz: d44aaaf54c4be5f05388d635b9472fee970527dd09aa47ef3ffb429dadd32cdbaa820e1dee9198e53a33df353c151dfcd690d6da91ec79cb6e0a6852e0365611
6
+ metadata.gz: 4ae27a5ebabefb268a13d347d6470a51235845c4207e2134b29e46b9ccaf81affedd38c7090781f3430fd53ca07470716fb0e23af742b19d77108d46d9cb5585
7
+ data.tar.gz: bc7b8d1901d0eb3b0ce2bcf20690e5d93b841e9e9376b2f8c5f0ced2e9c9228edbfb69f5ee1ef49b1c097433376c85d234b070fc97140da388642ea34222c8b3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.7 (2026-10-26)
4
+
5
+ - A symlink that points to itself no longer crashes a run. Ruby's Dir.glob
6
+ raised ELOOP when a pattern looked inside one; judgelint now skips it.
7
+
3
8
  ## 0.1.6 (2026-10-26)
4
9
 
5
10
  - `--base` and `--pr` ask about the changed lines, not the 40-line windows
@@ -14,7 +14,27 @@ module Judgelint
14
14
  end
15
15
 
16
16
  def self.expand(patterns)
17
- patterns.flat_map { |pattern| Dir.glob(pattern) }.select { |path| File.file?(path) }.uniq.sort
17
+ patterns.flat_map { |pattern| glob(pattern) }.select { |path| File.file?(path) }.uniq.sort
18
+ end
19
+
20
+ # Dir.glob, except that a symlink to itself is skipped. Dir.glob raises
21
+ # ELOOP when a pattern looks inside one, so the pattern is then globbed a
22
+ # segment at a time, entering only directories that resolve.
23
+ def self.glob(pattern)
24
+ Dir.glob(pattern)
25
+ rescue Errno::ELOOP
26
+ parts = pattern.split("/")
27
+ found = [""]
28
+ until parts.empty?
29
+ part = parts.shift
30
+ part = "#{part}/#{parts.shift}" if part == "**" && !parts.empty?
31
+ found = found.flat_map do |dir|
32
+ next [] unless dir.empty? || File.directory?(dir)
33
+
34
+ Dir.glob(dir.empty? ? part : File.join(dir, part))
35
+ end
36
+ end
37
+ found
18
38
  end
19
39
 
20
40
  # The files to check: in a git repository, those git tracks or would add,
@@ -89,7 +89,7 @@ module Judgelint
89
89
 
90
90
  # The directories a directory rule governs.
91
91
  def directories
92
- paths.flat_map { |pattern| Dir.glob(pattern) }.select { |path| File.directory?(path) && applies_to?(path) }.uniq.sort
92
+ paths.flat_map { |pattern| Glob.glob(pattern) }.select { |path| File.directory?(path) && applies_to?(path) }.uniq.sort
93
93
  end
94
94
 
95
95
  # The ranges to ask about: windows of +size+ lines, or the whole file.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Judgelint
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judgelint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Camara