mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-23 09:20:12 +01:00
Replace helpers.urlRe with helpers.urlFe to address "innefficient regular expression" CodeQL alert, introduce function expressions as an alternative, test more inputs.
This commit is contained in:
parent
485c63c579
commit
8d6e0b5419
5 changed files with 277 additions and 35 deletions
|
|
@ -3,7 +3,8 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorDetailIf, escapeForRegExp, forEachLine, forEachLink,
|
||||
linkReferenceDefinitionRe, urlRe, withinAnyRange } = require("../helpers");
|
||||
funcExpExec, linkReferenceDefinitionRe, urlFe, withinAnyRange } =
|
||||
require("../helpers");
|
||||
const { codeBlockAndSpanRanges, htmlElementRanges, lineMetadata } =
|
||||
require("./cache");
|
||||
|
||||
|
|
@ -27,7 +28,8 @@ module.exports = {
|
|||
exclusions.push([ lineIndex, 0, line.length ]);
|
||||
} else {
|
||||
let match = null;
|
||||
while ((match = urlRe.exec(line)) !== null) {
|
||||
while ((match = funcExpExec(urlFe, line)) !== null) {
|
||||
// @ts-ignore
|
||||
exclusions.push([ lineIndex, match.index, match[0].length ]);
|
||||
}
|
||||
forEachLink(line, (index, _, text, destination) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue