UNPKG

hardhat-output-validator

Version:

Zero-config Hardhat plugin to check the build output of Solidity contracts

29 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkForCompilationWarnings = void 0; const types_1 = require("../types"); const errors_1 = require("../errors"); const checkForCompilationWarnings = (buildInfo, severityLevel) => { const errors = {}; for (const bi of buildInfo) { const outputErrors = bi.output.errors; if (outputErrors && outputErrors.length > 0) { outputErrors.forEach((err) => { if (!errors[err.sourceLocation.file]) { errors[err.sourceLocation.file] = []; } const filePath = err.sourceLocation.file; const fileComponents = filePath.split('/'); const fileName = fileComponents[fileComponents.length - 1]; const errorHandler = (0, errors_1.getErrorHandler)(filePath, fileName); const { addError, getAll } = errorHandler; addError(types_1.ErrorType.CompilationWarning, severityLevel, err.formattedMessage); errors[err.sourceLocation.file].push(...getAll()); }); break; } } return errors; }; exports.checkForCompilationWarnings = checkForCompilationWarnings; //# sourceMappingURL=1compWarnings.js.map