judgelint 0.1.8-aarch64-linux → 0.1.9-aarch64-linux
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/judgelint/question.rb +8 -3
- data/lib/judgelint/runner.rb +24 -15
- data/lib/judgelint/source.rb +12 -8
- data/lib/judgelint/version.rb +1 -1
- data/libexec/judgelint +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7553c09944708dc9ac47e689dbb33104cca41ef9cd7f0c43a411e765936ce9df
|
|
4
|
+
data.tar.gz: 74aad9adec4f3f2199a6f341968d1912135e90717b5508d72399ada6e2a8a446
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d27fb1251406a09282e53f7c84001fce54068dd9c9d46f2e359fc0e3eda20177501736b5bdb19a81c084b9611fad66460c0bb621ec1d134361dc71065f2a911f
|
|
7
|
+
data.tar.gz: 73f4b3ed80fb02d9adb2d753273bf398dca20809c4ef46216af06745b14da6ff14f726ee41710864912e1658ecacd640e5f39bebbe79fc62afe43c398fa4cc74
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.9 (2026-10-27)
|
|
4
|
+
|
|
5
|
+
- `check` uses much less memory on large projects. On 50,000 files its
|
|
6
|
+
peak falls from 835 MB to 518 MB in Ruby and from 2.25 GB to 856 MB in
|
|
7
|
+
the native binary. Output is unchanged.
|
|
8
|
+
|
|
3
9
|
## 0.1.8 (2026-10-26)
|
|
4
10
|
|
|
5
11
|
- YAML that names a class `safe_load` won't build, like `!ruby/sym` or a
|
data/lib/judgelint/question.rb
CHANGED
|
@@ -21,12 +21,13 @@ module Judgelint
|
|
|
21
21
|
EXCUSED = "A judgehint comment is about this rule, and gives a reason the code may break it."
|
|
22
22
|
NOT_EXCUSED = "No judgehint comment is about this rule. Any judgehint is about a different rule, or gives no reason."
|
|
23
23
|
|
|
24
|
-
attr_reader :rule, :first, :last, :
|
|
24
|
+
attr_reader :rule, :first, :last, :lines
|
|
25
25
|
|
|
26
26
|
# +kind+ is :verdict, :where, or :excuse. +places+ are a :where question's
|
|
27
|
-
# options
|
|
27
|
+
# options as the model sees them: the directory's files, or nil for the
|
|
28
|
+
# range's line ids (L12).
|
|
28
29
|
# +lines+ are the changed lines in the range, or nil to ask about all of it.
|
|
29
|
-
def initialize(rule, first, last, kind: :verdict, places:
|
|
30
|
+
def initialize(rule, first, last, kind: :verdict, places: nil, lines: nil)
|
|
30
31
|
@rule = rule
|
|
31
32
|
@first = first
|
|
32
33
|
@last = last
|
|
@@ -35,6 +36,10 @@ module Judgelint
|
|
|
35
36
|
@lines = lines
|
|
36
37
|
end
|
|
37
38
|
|
|
39
|
+
def places
|
|
40
|
+
@places || (first..last).map { |line| "L#{line}" }
|
|
41
|
+
end
|
|
42
|
+
|
|
38
43
|
def excuse?
|
|
39
44
|
@kind == :excuse
|
|
40
45
|
end
|
data/lib/judgelint/runner.rb
CHANGED
|
@@ -14,22 +14,27 @@ module Judgelint
|
|
|
14
14
|
# One file's work: the questions to ask, each model's answers (from the
|
|
15
15
|
# cache or the model), and the requests still to send.
|
|
16
16
|
class Job
|
|
17
|
-
attr_reader :source, :
|
|
17
|
+
attr_reader :source, :state_digest, :questions, :answers, :requests, :expected
|
|
18
18
|
attr_accessor :skipped
|
|
19
19
|
|
|
20
|
-
# The state is
|
|
21
|
-
#
|
|
22
|
-
#
|
|
20
|
+
# The state is the whole file, and a run plans every file before it
|
|
21
|
+
# sends one, so it's built when needed rather than kept. Its hash, which
|
|
22
|
+
# every question's cache key needs, is kept.
|
|
23
23
|
def initialize(source, questions, prose: nil, expected: nil)
|
|
24
24
|
@source = source
|
|
25
|
-
@
|
|
26
|
-
@state_digest = Digest::SHA256.hexdigest(JSON.generate(
|
|
25
|
+
@prose = prose
|
|
26
|
+
@state_digest = Digest::SHA256.hexdigest(JSON.generate(state))
|
|
27
27
|
@questions = questions
|
|
28
28
|
@answers = {} # model index => {question key => probability or nil}
|
|
29
29
|
@requests = []
|
|
30
30
|
@expected = expected
|
|
31
31
|
@skipped = false
|
|
32
32
|
end
|
|
33
|
+
|
|
34
|
+
# Rules from a spec read its prose alongside the file, as team_rules.
|
|
35
|
+
def state
|
|
36
|
+
@prose ? { "team_rules" => @prose, "file" => @source.state } : @source.state
|
|
37
|
+
end
|
|
33
38
|
end
|
|
34
39
|
|
|
35
40
|
# Questions sent together to one model, and their estimated input tokens.
|
|
@@ -185,8 +190,7 @@ module Judgelint
|
|
|
185
190
|
asked = []
|
|
186
191
|
ranges.each do |first, last|
|
|
187
192
|
asked << Question.new(rule, first, last, lines: changed_lines(rule, lines, first, last))
|
|
188
|
-
|
|
189
|
-
asked << Question.new(rule, first, last, kind: :where, places: places) unless places.empty?
|
|
193
|
+
asked << where(source, rule, first, last) if where?(source, rule, first, last)
|
|
190
194
|
asked << Question.new(rule, first, last, kind: :excuse) if source.hinted?(first, last)
|
|
191
195
|
end
|
|
192
196
|
questions[rule] = asked
|
|
@@ -196,14 +200,17 @@ module Judgelint
|
|
|
196
200
|
job
|
|
197
201
|
end
|
|
198
202
|
|
|
199
|
-
#
|
|
200
|
-
#
|
|
203
|
+
# Where a bullet is broken is asked over the range's lines or the
|
|
204
|
+
# directory's files, but not for a rule written as a question, or past
|
|
201
205
|
# what a choice can hold.
|
|
202
|
-
def
|
|
203
|
-
|
|
206
|
+
def where?(source, rule, first, last)
|
|
207
|
+
rule.convention && (rule.directory? ? source.members.size : last - first + 1) <= MAX_OPTIONS
|
|
208
|
+
end
|
|
204
209
|
|
|
205
|
-
|
|
206
|
-
|
|
210
|
+
# A file's line ids are made when the question is sent, not kept.
|
|
211
|
+
def where(source, rule, first, last)
|
|
212
|
+
places = rule.directory? ? source.members.map { |_path, shown| shown } : nil
|
|
213
|
+
Question.new(rule, first, last, kind: :where, places: places)
|
|
207
214
|
end
|
|
208
215
|
|
|
209
216
|
# Rules that read different context files or spec prose can't share a request.
|
|
@@ -264,7 +271,9 @@ module Judgelint
|
|
|
264
271
|
|
|
265
272
|
# Sends every request at once: a file's packed requests and every model's.
|
|
266
273
|
def ask(job)
|
|
267
|
-
|
|
274
|
+
return if job.requests.empty?
|
|
275
|
+
|
|
276
|
+
state = job.state
|
|
268
277
|
results = Pool.map(job.requests, job.requests.size) do |request|
|
|
269
278
|
@clients[request.model].judge(state, request.questions)
|
|
270
279
|
end
|
data/lib/judgelint/source.rb
CHANGED
|
@@ -19,16 +19,20 @@ module Judgelint
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# +text+ is the file's contents when it isn't on disk, like an example in a spec.
|
|
22
|
+
# Each file is kept as one string, since a run holds every file it plans.
|
|
22
23
|
def initialize(path, shown_as: path, files: [path], context: [], directory: false, text: nil)
|
|
23
24
|
@path = path
|
|
24
25
|
@shown_as = shown_as
|
|
25
26
|
@directory = directory
|
|
26
|
-
@files = text ? [[path, text
|
|
27
|
+
@files = text ? [[path, text]] : files.map { |file| [file, File.read(file)] }
|
|
27
28
|
@context = context
|
|
28
|
-
@line_count =
|
|
29
|
+
@line_count = 0
|
|
29
30
|
@hints = []
|
|
30
|
-
@files.each do |_file,
|
|
31
|
-
|
|
31
|
+
@files.each do |_file, contents|
|
|
32
|
+
contents.each_line do |line|
|
|
33
|
+
@line_count += 1
|
|
34
|
+
@hints << @line_count if HINT.match?(line)
|
|
35
|
+
end
|
|
32
36
|
end
|
|
33
37
|
end
|
|
34
38
|
|
|
@@ -39,7 +43,7 @@ module Judgelint
|
|
|
39
43
|
def state
|
|
40
44
|
body =
|
|
41
45
|
if directory?
|
|
42
|
-
sections = @files.map { |file,
|
|
46
|
+
sections = @files.map { |file, contents| "Path: #{shown(file)}\n\n#{numbered(contents)}" }
|
|
43
47
|
"Directory: #{shown_as}\n\n#{sections.join("\n")}"
|
|
44
48
|
else
|
|
45
49
|
"Path: #{shown_as}\n\n#{numbered(@files.first[1])}"
|
|
@@ -57,7 +61,7 @@ module Judgelint
|
|
|
57
61
|
|
|
58
62
|
# The directory's files as [path, the path the model sees].
|
|
59
63
|
def members
|
|
60
|
-
@files.map { |file,
|
|
64
|
+
@files.map { |file, _contents| [file, shown(file)] }
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
def hinted?(first, last)
|
|
@@ -66,8 +70,8 @@ module Judgelint
|
|
|
66
70
|
|
|
67
71
|
private
|
|
68
72
|
|
|
69
|
-
def numbered(
|
|
70
|
-
lines.each_with_index.map { |line, index| "#{index + 1}: #{line.chomp}\n" }.join
|
|
73
|
+
def numbered(contents)
|
|
74
|
+
contents.lines.each_with_index.map { |line, index| "#{index + 1}: #{line.chomp}\n" }.join
|
|
71
75
|
end
|
|
72
76
|
|
|
73
77
|
# A file's path inside the directory, as the model sees it.
|
data/lib/judgelint/version.rb
CHANGED
data/libexec/judgelint
CHANGED
|
Binary file
|