refactor: simplify pass (trekexecute)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fc865ca07a
commit
bb3884d0f4
3 changed files with 16 additions and 17 deletions
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
import { resolve } from 'node:path';
|
||||
import {
|
||||
normalizeSeverity, contentOverlap, contentTokens, DEFAULT_THRESHOLD, ANCHOR_MIN_CONTENT_WORDS,
|
||||
normalizeSeverity, contentOverlap, contentTokens, DEFAULT_THRESHOLD, ANCHOR_MIN_CONTENT_WORDS, SEVERITIES,
|
||||
} from './plan-review-dedup.mjs';
|
||||
import { getRule } from './rule-catalogue.mjs';
|
||||
|
||||
|
|
@ -215,8 +215,7 @@ export function lineDiff(oldText, newText) {
|
|||
// ---- counting (rule A, rule B) ----------------------------------------------------
|
||||
|
||||
// Lower index = more severe; an unrated severity counts as blocker.
|
||||
const SEV_ORDER = ['blocker', 'major', 'minor'];
|
||||
const rankOf = s => SEV_ORDER.indexOf(s);
|
||||
const rankOf = s => SEVERITIES.indexOf(s);
|
||||
const countedOf = s => normalizeSeverity(s) ?? 'blocker';
|
||||
const higher = (a, b) => (rankOf(a) <= rankOf(b) ? a : b);
|
||||
const hasOwn = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
||||
|
|
@ -363,7 +362,7 @@ function carry(p, matched, d, current, prevRound) {
|
|||
out.line = current.opToFull[n] ?? out.line;
|
||||
const e = Number.isInteger(p.op_line_end) ? (d.oldToNew[p.op_line_end] ?? null) : null;
|
||||
const eFull = e !== null ? (current.opToFull[e] ?? null) : null;
|
||||
if (e !== null && eFull !== null) {
|
||||
if (eFull !== null) {
|
||||
out.line_end = eFull;
|
||||
out.op_line_end = e;
|
||||
} else {
|
||||
|
|
@ -389,7 +388,7 @@ function carry(p, matched, d, current, prevRound) {
|
|||
}
|
||||
|
||||
/** One line: the reason a round is counted fully. */
|
||||
const oneLine = s => String(s).replace(/\s*[\r\n]+\s*/g, ' ').trim();
|
||||
export const oneLine = s => String(s).replace(/\s*[\r\n]+\s*/g, ' ').trim();
|
||||
|
||||
/**
|
||||
* Count one critic round by rule A (from round 2, against the diff since the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue