mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update code to fix or document false positives for CodeQL warnings.
This commit is contained in:
parent
f1f6868a2c
commit
aa7fbce2dd
3 changed files with 7 additions and 2 deletions
|
|
@ -36,6 +36,8 @@ function assertLintResults(results: markdownlint.LintResults) {
|
||||||
assert(!results["string"][0].fixInfo.deleteCount);
|
assert(!results["string"][0].fixInfo.deleteCount);
|
||||||
assert.equal(results["string"][0].fixInfo.insertText, "\n");
|
assert.equal(results["string"][0].fixInfo.insertText, "\n");
|
||||||
assert.equal(results["../bad.md"].length, 2);
|
assert.equal(results["../bad.md"].length, 2);
|
||||||
|
// Deliberate assignment to unused variable validates types
|
||||||
|
// False-positive for js/useless-assignment-to-local
|
||||||
results = {
|
results = {
|
||||||
"key": [
|
"key": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,8 @@ module.exports.isObject = function isObject(obj) {
|
||||||
// Example: Contains nothing, whitespace, or comments
|
// Example: Contains nothing, whitespace, or comments
|
||||||
const blankLineRe = />|(?:<!--.*?-->)/g;
|
const blankLineRe = />|(?:<!--.*?-->)/g;
|
||||||
module.exports.isBlankLine = function isBlankLine(line) {
|
module.exports.isBlankLine = function isBlankLine(line) {
|
||||||
|
// Call to String.replace follows best practices and is not a security check
|
||||||
|
// False-positive for js/incomplete-multi-character-sanitization
|
||||||
return !line || !line.trim() || !line.replace(blankLineRe, "").trim();
|
return !line || !line.trim() || !line.replace(blankLineRe, "").trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -355,6 +357,7 @@ function forEachInlineCodeSpan(input, handler) {
|
||||||
let currentTicks = 0;
|
let currentTicks = 0;
|
||||||
let state = "normal";
|
let state = "normal";
|
||||||
// Deliberate <= so trailing 0 completes the last span (ex: "text `code`")
|
// Deliberate <= so trailing 0 completes the last span (ex: "text `code`")
|
||||||
|
// False-positive for js/index-out-of-bounds
|
||||||
for (; index <= input.length; index++) {
|
for (; index <= input.length; index++) {
|
||||||
const char = input[index];
|
const char = input[index];
|
||||||
// Ignore backticks in link destination
|
// Ignore backticks in link destination
|
||||||
|
|
|
||||||
|
|
@ -809,10 +809,10 @@ tape("readme", (test) => {
|
||||||
) {
|
) {
|
||||||
if (!seenRelated) {
|
if (!seenRelated) {
|
||||||
seenRelated = true;
|
seenRelated = true;
|
||||||
} else if (seenRelated && !seenRules) {
|
} else if (!seenRules) {
|
||||||
seenRules = true;
|
seenRules = true;
|
||||||
inRules = true;
|
inRules = true;
|
||||||
} else if (seenRelated && seenRules && !seenTags) {
|
} else if (!seenTags) {
|
||||||
seenTags = true;
|
seenTags = true;
|
||||||
inTags = true;
|
inTags = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue