Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion monitor/sarif-read.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ const FILE_PARTIAL_IDS = Object.freeze({
'Fixpoint timeout': 'fixpoint-timeout',
});
// The third shape is Semgrep giving up on a whole file: "Timeout at line <file>:<line>:", no rule.
const FILE_OF = [/ on (.+?):\s*$/s, /^(?:Other )?(?:Syntax|Lexical) error at line (.+?):\d+:/, /^Timeout at line (.+?):\d+:/,
// Semgrep writes "Other syntax error" with a lower-case `s` (measured on machdep.h, 2026-11-29), so
// the syntax/lexical pattern is case-insensitive. Without the flag that notice yields no uri and the
// file is dropped from the coverage count — the silent-clean class this list exists to close.
const FILE_OF = [/ on (.+?):\s*$/s, /^(?:Other )?(?:Syntax|Lexical) error at line (.+?):\d+:/i, /^Timeout at line (.+?):\d+:/,
/^Fixpoint timeout while performing taint analysis at (.+?):\d+:\d+/];
/** The reasons bin/semgrep-retry.mjs re-measures; the others are about parsing, which a retry repeats. */
export const RETRIED_REASONS = Object.freeze(['timeout', 'fixpoint-timeout']);
Expand Down
10 changes: 10 additions & 0 deletions monitor/test/unit-sarif-read-partial-analysis.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,13 @@ test('sorts output rows by uri then rule', () => {
] }];
assert.deepEqual(partialAnalysis(inv), [{ uri: "a.js", reasons: ["timeout"], notices: 1 }, { uri: "z.js", reasons: ["timeout"], notices: 1 }]);
});

test('resolves the uri from an "Other syntax error" notice, which Semgrep writes with a lower-case s', () => {
const inv = [{ toolExecutionNotifications: [{ descriptor: { id: 'Other syntax error' }, message: { text: 'Other syntax error at line machdep.h:1:\n Failure: found invalid inline assembler statement as expression' } }] }];
assert.deepEqual(partialAnalysis(inv), [{ uri: "machdep.h", reasons: ["syntax-error"], notices: 1 }]);
});

test('still resolves the uri from a capitalised "Syntax error" notice', () => {
const inv = [{ toolExecutionNotifications: [{ descriptor: { id: 'Syntax error' }, message: { text: 'Syntax error at line src/c.c:12:\n unexpected' } }] }];
assert.deepEqual(partialAnalysis(inv), [{ uri: "src/c.c", reasons: ["syntax-error"], notices: 1 }]);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commitwork",
"version": "0.6.347",
"version": "0.6.348",
"description": "Repository security scanner, local CI runner and scheduled monitor, with remediation and compliance-evidence tooling. Manifest-driven; runs against any git repository.",
"homepage": "https://www.commitwork.online",
"repository": {
Expand Down
Loading