_markCoinMinerUsage()

in src/linter.js [697:743]


  _markCoinMinerUsage(filename, fileData) {
    if (fileData && fileData.trim()) {
      MINER_BLOCKLIST.filenames.forEach((nameRegex) => {
        const filenameMatch = filename.match(nameRegex);

        if (filenameMatch) {
          this.collector.addWarning({
            ...messages.COINMINER_USAGE_DETECTED,
            file: filename,
          });
        }

        const fileDataMatch = fileData.match(nameRegex);

        if (fileDataMatch) {
          const { matchedLine, matchedColumn } =
            getLineAndColumnFromMatch(fileDataMatch);

          this.collector.addWarning({
            ...messages.COINMINER_USAGE_DETECTED,
            file: filename,
            column: matchedColumn,
            line: matchedLine,
          });
        }
      });

      MINER_BLOCKLIST.code.forEach((codeRegex) => {
        const match = fileData.match(codeRegex);

        if (match) {
          const { matchedLine, matchedColumn } =
            getLineAndColumnFromMatch(match);

          this.collector.addWarning({
            ...messages.COINMINER_USAGE_DETECTED,
            file: filename,
            line: matchedLine,
            column: matchedColumn,
            // use instancePath for our actual match to avoid any obvious
            // duplicates
            instancePath: match[0],
          });
        }
      });
    }
  }