Skip to content

Commit

Permalink
Silence GitLab's warnings about a couple regexps
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultxavi committed May 30, 2024
1 parent 7e77d62 commit b3872de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docgen/template/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@ export function linkify(this: DocItemWithContext, text?: string, joinLines?: boo
// brackets).
// It's not foolproof, results still need to be reviewed.
const suffix = node.nodeType == 'FunctionDefinition' ? "_" + node.functionSelector : "";
// nosemgrep: detect-non-literal-regexp
ret = ret.replace(new RegExp(`\`?\\b${node.name}\\b(\\(\\))*\`?(?![^\\[]*])(?<!]\\([^)]*)`, 'g'),
`[\`${node.name}\`](#${anchorName(node.nodeType, node.name, suffix)})`);
});
});
}
// Look for references to other contract names. Same regex as before, same comments.
globalContractTable.forEach(s => {
// nosemgrep: detect-non-literal-regexp
ret = ret.replace(new RegExp(`\`?\\b${s}\\b(\\(\\))*\`?(?![^\\[]*])(?<!]\\([^)]*)`, 'g'),
`[\`${s}\`](./${s}.md)`);
});
Expand Down

0 comments on commit b3872de

Please sign in to comment.