Skip to content

Commit bf7b52a

Browse files
committed
regroup handling of diffMaxLineLength and diffMaxChanges in parser
1 parent a4e619e commit bf7b52a

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/diff-parser.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -307,25 +307,11 @@ export function parse(diffInput: string, config: DiffParserConfig = {}): DiffFil
307307
return;
308308
}
309309

310-
if (currentFile && typeof config.diffMaxLineLength === 'number' && line.length > config.diffMaxLineLength) {
311-
currentFile.isTooBig = true;
312-
currentFile.addedLines = 0;
313-
currentFile.deletedLines = 0;
314-
currentFile.blocks = [];
315-
currentBlock = null;
316-
317-
const message =
318-
typeof config.diffTooBigMessage === 'function'
319-
? config.diffTooBigMessage(files.length)
320-
: 'Diff too big to be displayed';
321-
startBlock(message);
322-
return;
323-
}
324-
325310
if (
326311
currentFile &&
327-
typeof config.diffMaxChanges === 'number' &&
328-
currentFile.addedLines + currentFile.deletedLines > config.diffMaxChanges
312+
((typeof config.diffMaxChanges === 'number' &&
313+
currentFile.addedLines + currentFile.deletedLines > config.diffMaxChanges) ||
314+
(typeof config.diffMaxLineLength === 'number' && line.length > config.diffMaxLineLength))
329315
) {
330316
currentFile.isTooBig = true;
331317
currentFile.addedLines = 0;

0 commit comments

Comments
 (0)