@voidh4x0r/slopgate 0.1.5 → 0.1.6

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,16 @@ 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.6] - 2026-11-22
13
+
14
+ ### Fixed
15
+ - `py/swallowed-exception` treats future-work wording (`later`, `next sprint/release/iteration`, `someday`, `eventually`) as noise again, while a real cleanup explanation without future wording still demotes.
16
+ - `py/noop-test` recognises a test whose last statement calls a module-local helper containing an assertion, reporting it at medium confidence. This matches the TypeScript delegated-helper behaviour; the lexical assertion-name list remains for `verify(...)`-style helpers.
17
+
18
+ ### Changed
19
+ - 245 tests, including sixth-round regression fixtures for `noise`, `py-named-helper` and `py-delegated`.
20
+ - 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: []`.
21
+
12
22
  ## [0.1.5] - 2026-11-22
13
23
 
14
24
  ### Fixed
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.5 · 4 files · 39ms
17
+ slopgate 0.1.6 · 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
@@ -204,7 +204,7 @@ jobs:
204
204
  - uses: actions/checkout@v4
205
205
  - uses: actions/setup-node@v4
206
206
  with: { node-version: 22 }
207
- - run: npx --yes @voidh4x0r/slopgate@0.1.5 . --fail-on high
207
+ - run: npx --yes @voidh4x0r/slopgate@0.1.6 . --fail-on high
208
208
  ```
209
209
 
210
210
  For GitHub code scanning, use `--format sarif` and upload with `github/codeql-action/upload-sarif`.
@@ -212,7 +212,7 @@ For GitHub code scanning, use `--format sarif` and upload with `github/codeql-ac
212
212
  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):
213
213
 
214
214
  ```yaml
215
- - run: npx --yes @voidh4x0r/slopgate@0.1.5 . --format github --fail-on high
215
+ - run: npx --yes @voidh4x0r/slopgate@0.1.6 . --format github --fail-on high
216
216
  ```
217
217
 
218
218
  Each finding becomes an `error` / `warning` / `notice` annotation on the exact line, followed by a summary notice.
@@ -297,7 +297,7 @@ Issues and pull requests are welcome. Start with [CONTRIBUTING.md](https://githu
297
297
  git clone https://github.com/VoidH4x0r/slopgate
298
298
  cd slopgate
299
299
  npm install
300
- npm test # 241 tests; the tests themselves make no network or child-process calls
300
+ npm test # 245 tests; the tests themselves make no network or child-process calls
301
301
  npm run typecheck
302
302
  npm run verify # all release gates in one command
303
303
  ```
@@ -111,6 +111,34 @@ function bodyCallsSelf(body) {
111
111
  });
112
112
  return found;
113
113
  }
114
+ /** Module-local helpers whose bodies contain an assertion. */
115
+ function localAssertionHelpers(root) {
116
+ const helpers = new Map();
117
+ for (const fn of descendantsOfType(root, ['function_definition'])) {
118
+ if (fn.parent?.type === 'class_definition')
119
+ continue;
120
+ const name = fn.childForFieldName('name')?.text;
121
+ if (!name || testFunctionName(fn))
122
+ continue;
123
+ const body = fn.childForFieldName('body');
124
+ if (body && hasAssertion(body))
125
+ helpers.set(name, fn);
126
+ }
127
+ return helpers;
128
+ }
129
+ /** The last statement calling a local helper can carry the assertions. */
130
+ function delegatesToLocalHelper(statements, helpers) {
131
+ const last = statements[statements.length - 1];
132
+ if (!last)
133
+ return undefined;
134
+ const call = last.type === 'expression_statement' || last.type === 'return_statement'
135
+ ? last.namedChildren[0]
136
+ : undefined;
137
+ if (call?.type !== 'call')
138
+ return undefined;
139
+ const name = collapseWhitespace(call.childForFieldName('function')?.text ?? '');
140
+ return /^[A-Za-z_]\w*$/.test(name) && helpers.has(name) ? name : undefined;
141
+ }
114
142
  function placeholderForm(block) {
115
143
  const statements = statementsOf(block);
116
144
  const afterDocstring = statements[0]?.type === 'expression_statement' &&
@@ -269,6 +297,7 @@ const noopTest = {
269
297
  if (isStubFile(ctx.file))
270
298
  return [];
271
299
  const drafts = [];
300
+ const helpers = localAssertionHelpers(ctx.root);
272
301
  for (const fn of descendantsOfType(ctx.root, ['function_definition'])) {
273
302
  const name = testFunctionName(fn);
274
303
  if (!name)
@@ -305,6 +334,7 @@ const noopTest = {
305
334
  }
306
335
  if (!hasAssertion(body)) {
307
336
  const delegatesToSelf = bodyCallsSelf(body);
337
+ const delegatedTo = delegatesToLocalHelper(statements, helpers);
308
338
  const parameters = fn.childForFieldName('parameters');
309
339
  const parameterCount = parameters
310
340
  ? parameters.namedChildren.filter((child) => child.type !== 'comment').length
@@ -324,7 +354,7 @@ const noopTest = {
324
354
  const camelCase = !name.startsWith('test_');
325
355
  const likelyHelper = !inClass && (parameterCount >= 2 || helperDecorator || (camelCase && parameterCount >= 1));
326
356
  // unittest-style methods routinely delegate assertions to helpers.
327
- const confidence = inClass || delegatesToSelf || likelyHelper ? 'medium' : 'high';
357
+ const confidence = inClass || delegatesToSelf || delegatedTo !== undefined || likelyHelper ? 'medium' : 'high';
328
358
  drafts.push({
329
359
  message: `test \`${name}\` makes no assertions`,
330
360
  start: startOf(fn),
@@ -336,6 +366,9 @@ const noopTest = {
336
366
  `statements: ${statements.length}`,
337
367
  'no assert / raises / mock assertion found',
338
368
  ...(delegatesToSelf ? ['the body calls a self.* helper, which may contain the assertions'] : []),
369
+ ...(delegatedTo
370
+ ? [`last statement calls \`${delegatedTo}\`, whose body contains an assertion`]
371
+ : []),
339
372
  ...(inClass && !delegatesToSelf ? ['defined inside a test class, where helpers often hold the assertions'] : []),
340
373
  ...(likelyHelper ? ['takes several parameters or uses a helper decorator, so it may be a test helper'] : []),
341
374
  ],
@@ -457,7 +490,7 @@ const FAILURE_WORDS = /error|fail|throw|exception|invalid|log|raise/i;
457
490
  const INTENT_WORDS = /ignor\w*|abort|skip|safe|accept|fallback|best effort|tolerate|\bok\b|fine/i;
458
491
  const STRONG_EXPLANATION = /harmless|benign|intentional|by design|safe to ignore|expected (?:error|failure|exception|behaviou?r)/i;
459
492
  /** Comments that describe future work, not why an error is safe to ignore. */
460
- const NOISE_COMMENT = /\b(TODO|FIXME|XXX|HACK)\b/i;
493
+ const NOISE_COMMENT = /\b(TODO|FIXME|XXX|HACK)\b|\b(later|next (sprint|release|iteration)|someday|eventually)\b/i;
461
494
  function isExplanationText(text) {
462
495
  return STRONG_EXPLANATION.test(text) || (FAILURE_WORDS.test(text) && INTENT_WORDS.test(text));
463
496
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidh4x0r/slopgate",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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",