
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
hardhat-ignore-warnings
Advanced tools
This plugin adds ways to ignore Solidity warnings, and a way to turn remaining warnings into errors.
Actual compilation errors will not be silenced by the plugin.
You can turn off all Solidity warnings by installing the plugin and configuring it as follows.
// hardhat.config.js
+require('hardhat-ignore-warnings');
module.exports = {
+ warnings: 'off',
};
You can be more selective about the warnings that should be ignored and those that shouldn't.
If you want to ignore a warning in a particular line without setting rules for the entire project, you can use inline comments.
// solc-ignore-next-line unused-param
function bar(uint x) public {
In order to ignore warnings or promote to errors across the entire project or in entire files, the plugin accepts more detailed configuration.
The config is an object that maps glob patterns to warning rules. These rules will be applied to files matched by the glob pattern. More specific patterns override the rules of less specific ones.
A warning can be set to 'off'
, 'error'
(promote to error), or 'warn'
(the default), as well as false
(meaning 'off'
) and true
(meaning the local default, or 'warn'
if none is set).
The special id default
can be used to apply a setting to all warnings at once.
warnings: {
// make every warning an error:
'*': 'error',
// equivalently:
'*': {
default: 'error',
},
// add an exception for a particular warning id:
'*': {
'code-size': 'warn',
default: 'error',
},
// turn off all warnings under a directory:
'contracts/test/**/*': {
default: 'off',
},
}
Both inline comments and detailed configuration use the following set of names to identify warnings.
unreachable
: "Unreachable code."unused-param
: "Unused function parameter. Remove or comment out the variable name to silence this warning."unused-var
: "Unused local variable."unused-call-retval
: "Return value of low-level calls not used."code-size
: "Contract code size is N bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries."shadowing
: "This declaration shadows an existing declaration."shadowing-builtin
: "This declaration shadows a builtin symbol."shadowing-opcode
: "Variable is shadowed in inline assembly by an instruction of the same name."func-mutability
: "Function state mutability can be restricted to pure/view."license
: "SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information."pragma-solidity
: "Source file does not specify required compiler version!"missing-receive
: "This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function." -- To ignore this warning with a comment, it must be placed before the contract definition.transient-storage
: "Transient storage as defined by EIP-1153 can break the composability of smart contracts: Since transient storage is cleared only at the end of the transaction and not at the end of the outermost call frame to the contract within a transaction, your contract may unintentionally misbehave when invoked multiple times in a complex transaction. To avoid this, be sure to clear all transient storage at the end of any call to your contract. The use of transient storage for reentrancy guards that are cleared at the end of the call is safe."FAQs
Hardhat plugin to ignore Solidity warnings
The npm package hardhat-ignore-warnings receives a total of 13,519 weekly downloads. As such, hardhat-ignore-warnings popularity was classified as popular.
We found that hardhat-ignore-warnings demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.