MCPcopy
hub / github.com/ampproject/amphtml / Program

Function Program

build-system/eslint-rules/no-forbidden-terms.js:15–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13module.exports = function (context) {
14 return {
15 Program() {
16 const filename = relative(process.cwd(), context.getFilename());
17 const sourceCode = context.getSourceCode();
18 const contents = sourceCode.text;
19
20 for (const terms of context.options) {
21 for (const report of matchForbiddenTerms(filename, contents, terms)) {
22 const {loc, match, message} = report;
23 const formattedMatch = cyan(`"${match}"`);
24 context.report({
25 loc,
26 message:
27 `Forbidden: ${formattedMatch}.` +
28 (message ? ` ${addPeriod(message)}` : ''),
29 });
30 }
31 }
32 },
33 };
34};

Callers

nothing calls this directly

Calls 4

matchForbiddenTermsFunction · 0.85
cyanFunction · 0.85
addPeriodFunction · 0.85
reportMethod · 0.45

Tested by

no test coverage detected