judgelint 0.2.2 → 0.2.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/README.md +44 -10
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 400d0c191393c6b8774d7315ff0b78c51a8a4e5ceb0f3fb68ee64d77be246e5d
4
- data.tar.gz: 9db2ca6dcfcc2fde28f22cdcfb4a9e6a9f5dcf8cf7513d747f9e945cf3511f73
3
+ metadata.gz: b1354e0507fcc053ddd7864f44bc91be0c64ed6b3e3d52cb593da93cc2d6ba40
4
+ data.tar.gz: 86ccd7c435bbf87fd4597984312a9555efe2ec340b7376a4b0a72e2956f97426
5
5
  SHA512:
6
- metadata.gz: 8a2d1e61d233079127c77a2edfb4d3ce2f891ab970b19eaec40351cadc0ad9965598c99c49c955db1fc835bd915f2acb8a489302ecad17cb111e1b3ac2a33ed6
7
- data.tar.gz: 1597e1869db571d8a7f00a421d4e9673df9bc770268298a30e0112cc5d73f889fed3e38bdbeb7463a7a2728c8249338b2398c52e18cdb0087d3b7501882cd8d1
6
+ metadata.gz: 3eadaf47b6bce5a917e47701565d626bbfe5043d7d3a464327d2d82fe942924ac323412ab2833ade56e621575865a3219020ff7a9e2461c914abf80a68b2ddf6
7
+ data.tar.gz: 138903af716ff185edabfa44282c32e2439d0b1609c4fd2da7a36971fff6a1f5343e4d07be0cdd22280eaf117f0923b93ee3df7236137da8bd31d8910bdaa630
data/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.4 (2026-10-30)
4
+
5
+ - On GitHub Actions' default checkout, `--pr` compares GitHub's merge
6
+ commit with its first parent, fetching it if the checkout is one commit
7
+ deep. The checkout needs no history, and a stacked pull request is
8
+ checked for its own changes, not the whole stack's. It's used only when
9
+ the run is a `pull_request` event for a `refs/pull/<n>/merge` ref and
10
+ HEAD is that run's commit, so a merge the pull request committed isn't
11
+ taken for GitHub's.
12
+ - Otherwise, on GitHub Actions, `--pr` reads the branch a pull request
13
+ targets from its event before `GITHUB_BASE_REF`, which names the branch
14
+ a whole stack targets.
15
+
16
+ ## 0.2.3 (2026-10-30)
17
+
18
+ `--pr` uses the pull request's own specs and cache again, and hardening
19
+ from a fourth review.
20
+
21
+ - `--pr` reads only `.judgelint.yml` from the base branch, so a pull
22
+ request still can't change where its code is sent or which key goes with
23
+ it. Its own specs and cache are used, as in 0.2.0: a new convention
24
+ applies to the pull request that adds it, and CI can keep the cache
25
+ between pushes. 0.2.1 read both from the base branch, so new rules waited
26
+ for a merge and every push asked again.
27
+ - A `##` in a file name or an endpoint's error is escaped in text output,
28
+ so it can't run an Azure Pipelines (`##vso[`) or TeamCity command. JSON
29
+ and SARIF write it as `#\u0023`, which reads back the same.
30
+ - Under `--base` or `--pr`, adding or changing a link to a directory asks
31
+ that directory's directory rules.
32
+ - A directory with `[`, `*`, `?` or `{` in its name sends its own files to
33
+ directory rules. Its name was read as a pattern, which could match
34
+ nothing.
35
+ - A changed file whose name isn't UTF-8 fails the run. It was read as
36
+ whatever file its name decoded to.
37
+ - `judgelint init` won't write through a `CONVENTIONS.md` link.
38
+ - The README says that patterns skip names that start with a dot unless
39
+ they name the dot.
40
+
3
41
  ## 0.2.2 (2026-10-30)
4
42
 
5
43
  Fixes from a third review of 0.2.1, which found ways around its fixes.
data/README.md CHANGED
@@ -55,7 +55,9 @@ judgelint: 1 request, 940 input tokens, $0.0000, typesafe:jev-latest
55
55
  ```
56
56
 
57
57
  That's all the setup there is. A `CONVENTIONS.md` covers the files in its
58
- directory and below, except Markdown and lockfiles. In a git repository,
58
+ directory and below, except Markdown, lockfiles, and names that start with a
59
+ dot. A pattern in `paths:` matches a dotted name only when it names the dot,
60
+ like `.github/*.yml`. In a git repository,
59
61
  judgelint skips what git ignores. It also skips binary files.
60
62
 
61
63
  judgelint asks Jev on TypeSafe. To use another provider, set `models` in
@@ -241,23 +243,55 @@ A new file is
241
243
  all changed lines. Rules about a whole file (`scope: file`) still read the
242
244
  whole file when any of it changed, and a directory rule asks about a
243
245
  directory when a file in it was changed, added or deleted. Only `check`
244
- takes `--base` and `--pr`. `--pr` gets the base branch from GitHub
245
- Actions, GitLab, Buildkite, Bitbucket, Azure Pipelines,
246
- `JUDGELINT_BASE_BRANCH`, or `gh`. Fetch enough history for git to find the
247
- merge base.
246
+ takes `--base` and `--pr`. `--pr` checks against `JUDGELINT_BASE_BRANCH`
247
+ when it's set, or else the base branch that GitHub Actions, GitLab,
248
+ Buildkite, Bitbucket, Azure Pipelines or `gh` names. git needs the history
249
+ back to the merge base, except on GitHub Actions' own checkout (below).
248
250
 
249
251
  Under `--base` or `--pr`, a changed file judgelint can't judge fails the
250
252
  run: one too large for the model, one the model refused to answer about,
251
253
  even in part, one that leads outside the project, or a binary one. Images,
252
254
  fonts, archives and other formats that are never code are left out instead.
253
255
 
256
+ On GitHub Actions, the default checkout is enough. Keep the cache between
257
+ pushes:
258
+
259
+ ```yaml
260
+ - uses: actions/checkout@v4
261
+ - uses: actions/cache@v4
262
+ with:
263
+ path: .judgelint/cache.bin
264
+ key: judgelint-${{ github.run_id }}
265
+ restore-keys: judgelint-
266
+ - run: judgelint --pr --format github
267
+ ```
268
+
269
+ That checkout is the merge commit GitHub makes for the pull request, and
270
+ `--pr` compares it with its first parent: the base branch, or for a stacked
271
+ pull request, the merge commit of the one below it. So a stacked pull
272
+ request is checked for its own changes, with the config of what it lands
273
+ on. judgelint fetches that parent with the checkout's credentials, so leave
274
+ `persist-credentials` at its default. Line numbers are the merge commit's:
275
+ if the base branch changed lines above an edit, an annotation can sit a few
276
+ lines from where the "Files changed" tab shows it.
277
+
278
+ To check the pull request's own commit instead, check it out with
279
+ `ref: ${{ github.event.pull_request.head.sha }}` and fetch the history
280
+ with `fetch-depth: 0` (`filter: blob:none` skips old file contents). `--pr`
281
+ then compares with the branch the pull request targets, read from GitHub's
282
+ event, since `GITHUB_BASE_REF` names the branch a whole stack targets.
283
+
254
284
  ### Pull requests from people you don't trust
255
285
 
256
- `--pr` reads `.judgelint.yml`, the specs, and `.judgelint/cache.bin` from the
257
- base branch, not from the pull request, so a pull request can't change the
258
- rules it's checked against, where its code is sent, or the answers it's
259
- judged by. New or changed conventions apply once they're merged. The base
260
- branch's cache is read into memory, and the checkout's own is left alone.
286
+ `--pr` reads `.judgelint.yml` from the base branch, or for a stacked pull
287
+ request from the one below it, not from the pull request, so a pull request can't change where its code is sent or which
288
+ API key goes with it.
289
+
290
+ The pull request's own specs and cache are used, so a new or changed
291
+ convention applies to it right away. That also means a pull request can
292
+ change its rules or the answers in its cache. Review those like any other
293
+ change, and have GitHub hold workflow runs on pull requests from forks
294
+ until you approve them (Settings → Actions).
261
295
 
262
296
  `--pr` judges what the pull request committed. Anything else in the
263
297
  checkout, like a file an earlier CI step wrote, is never sent, whatever the
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.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Camara