@voidh4x0r/slopgate 0.1.15 → 0.1.16

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,17 @@ All notable changes to this project are documented here. The format follows [Kee
9
9
  - Go and Rust grammars.
10
10
  - VS Code diagnostics.
11
11
 
12
+ ## [0.1.16] - 2026-11-22
13
+
14
+ ### Fixed
15
+ - `py/swallowed-exception` classifies the caught type independently of an `as name` binding: `except Exception as error:`, `except BaseException as e:`, `except (Exception,) as e:` and `except* Exception as e:` are high confidence again, with the broad “swallows the error” message instead of “specific error type”.
16
+ - Tuples containing `Exception`/`BaseException` are treated as broad; `(ValueError, RuntimeError)` remains specific/medium.
17
+
18
+ ### Changed
19
+ - 270 tests, including `as-binding` and `as-binding-more` fixtures covering bindings, `except*`, single-element and mixed tuples.
20
+ - Docs note that human-written benchmark corpora rarely exercise AI-specific `except … as e: pass` shapes; regression fixtures cover them until the 0.2.0 AI corpus.
21
+ - Benchmark unchanged at **29 high-confidence findings across 991,705 lines of CPython, 96.6% labeled precision (28/29), 14/14 seeded defects, 0 high findings on 601 JavaScript files**; `staleLabels: []`, `unlabeledHigh: []`.
22
+
12
23
  ## [0.1.15] - 2026-11-22
13
24
 
14
25
  ### Fixed
@@ -66,7 +77,7 @@ All notable changes to this project are documented here. The format follows [Kee
66
77
  ### Changed
67
78
  - **Behavior change:** a baseline written by an older version inside a scanned subdirectory is no longer found automatically; move it to the repository root or pass `--baseline`.
68
79
  - 259 tests, including repo-root config applying to directory/file scans and default-baseline read/write at the root.
69
- - The performance guard now ignores corpora under 500 ms, so 5% comparisons target the CPython/ESLint-scale scans rather than startup noise.
80
+ - The performance guard now ignores corpora under 1000 ms, so 5% comparisons target the CPython-scale scan rather than JavaScript startup noise.
70
81
  - Benchmark unchanged at **29 high-confidence findings across 991,705 lines of CPython, 96.6% labeled precision (28/29), 14/14 seeded defects, 0 high findings on 601 JavaScript files**; `staleLabels: []`, `unlabeledHigh: []`.
71
82
 
72
83
  ## [0.1.10] - 2026-11-22
package/README.md CHANGED
@@ -14,7 +14,7 @@ AI writes code that *looks* right. `slopgate` finds the parts that only look rig
14
14
  ```console
15
15
  $ npx @voidh4x0r/slopgate .
16
16
 
17
- slopgate 0.1.15 · 4 files · 39ms
17
+ slopgate 0.1.16 · 4 files · 39ms
18
18
 
19
19
  app.py
20
20
  4:1 error high py/phantom-import `helper` is imported but not declared in any manifest and not present in this repository
@@ -210,7 +210,7 @@ jobs:
210
210
  - uses: actions/checkout@v4
211
211
  - uses: actions/setup-node@v4
212
212
  with: { node-version: 22 }
213
- - run: npx --yes @voidh4x0r/slopgate@0.1.15 . --fail-on high
213
+ - run: npx --yes @voidh4x0r/slopgate@0.1.16 . --fail-on high
214
214
  ```
215
215
 
216
216
  For GitHub code scanning, use `--format sarif` and upload with `github/codeql-action/upload-sarif`.
@@ -218,7 +218,7 @@ For GitHub code scanning, use `--format sarif` and upload with `github/codeql-ac
218
218
  For inline pull-request annotations **without** code scanning, use `--format github`, which emits [workflow commands](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions):
219
219
 
220
220
  ```yaml
221
- - run: npx --yes @voidh4x0r/slopgate@0.1.15 . --format github --fail-on high
221
+ - run: npx --yes @voidh4x0r/slopgate@0.1.16 . --format github --fail-on high
222
222
  ```
223
223
 
224
224
  Each finding becomes an `error` / `warning` / `notice` annotation on the exact line, followed by a summary notice.
@@ -303,7 +303,7 @@ Issues and pull requests are welcome. Start with [CONTRIBUTING.md](https://githu
303
303
  git clone https://github.com/VoidH4x0r/slopgate
304
304
  cd slopgate
305
305
  npm install
306
- npm test # 267 tests; the tests themselves make no network or child-process calls
306
+ npm test # 270 tests; the tests themselves make no network or child-process calls
307
307
  npm run typecheck
308
308
  npm run verify # all release gates in one command
309
309
  ```
@@ -561,6 +561,20 @@ function isDocumentedNoopDirectory(ctx) {
561
561
  return false;
562
562
  return NOOP_MODULE_DOC.test(moduleDocstring(ctx.root) ?? '');
563
563
  }
564
+ /** Broad even when the expression is a tuple containing a catch-all type. */
565
+ function isBroadExceptionType(text) {
566
+ if (/^\(?\s*(Exception|BaseException)\s*,?\s*\)?$/.test(text))
567
+ return true;
568
+ if (text.startsWith('(') && text.endsWith(')')) {
569
+ const parts = text
570
+ .slice(1, -1)
571
+ .split(',')
572
+ .map((part) => collapseWhitespace(part))
573
+ .filter((part) => part.length > 0);
574
+ return parts.some((part) => part === 'Exception' || part === 'BaseException');
575
+ }
576
+ return false;
577
+ }
564
578
  const swallowedException = {
565
579
  meta: {
566
580
  id: 'py/swallowed-exception',
@@ -617,8 +631,11 @@ const swallowedException = {
617
631
  continue;
618
632
  const commented = above ||
619
633
  supportingCommentBetween(ctx, betweenStart, handlerEndRow + 1, clause.startPosition.row + 1);
634
+ // `except Exception as error:` binds the exception; the binding name
635
+ // says nothing about the caught type.
636
+ const baseType = typeText.replace(/\s+as\s+\S+$/, '').trim();
620
637
  const bare = typeText.length === 0;
621
- const broad = bare || /^(\(?\s*)?(Exception|BaseException)(\s*\))?$/.test(typeText);
638
+ const broad = bare || isBroadExceptionType(baseType);
622
639
  const cleanup = insideCleanupFunction(clause);
623
640
  const confidence = broad && !commented && !cleanup ? 'high' : 'medium';
624
641
  drafts.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidh4x0r/slopgate",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "The slop gate for AI-written code. Precision-first structural linting for Python and TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",