Comments (6)
@CJ42
sorry but there is no such configuration for that rule
see https://github.com/protofire/solhint/blob/master/docs/rules/best-practises/no-empty-blocks.md
you can open an issue to suggest adding that... we can address it for forthcoming versions
from solhint.
This release suggests that this option exist
https://github.com/protofire/solhint/releases/tag/3.5.1
from solhint.
omg!
That is weird
I'll check that asap
@CJ42 sorry for the bad response
from solhint.
ok... I checked
See this thread for more info:
#418
The changelog is missleading there is no such option... you can check the code. There is no configuration option for that rule as stated in the rule help readme
https://github.com/protofire/solhint/blob/develop/lib/rules/best-practises/no-empty-blocks.js
The rule just ignores an empty constructor as long as a base contract is being inherited
It will ignore this empty constructor because it is used to initialize the token contract:
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;
import { ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
contract PayableContract is ERC20Burnable{
constructor() ERC20("MyToken", "MTK") {}
// solhint-disable no-empty-blocks
function payableTrue() public payable {}
// solhint-disable no-empty-blocks
function payableFalse() public {}
}
But it will be a warning to this:
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;
contract PayableContract {
constructor() {}
// solhint-disable no-empty-blocks
function payableTrue() public payable {}
// solhint-disable no-empty-blocks
function payableFalse() public {}
}
Because there is no need to define an empty constructor...
from solhint.
@dbale-altoros Ok that makes sense, thank you for the clarification!
It would be good to document this imo (either in the Release detail or somewhere else), as it is not immediately clear when reading the CHANGELOG.
from solhint.
yes will do
from solhint.
Related Issues (20)
- Setup solhint to fail github CI on any warning with `--max-warnings 0` HOT 4
- dynamic loading of rules breaks bundlers HOT 3
- New rule `func-named-parameters` enforced on built-in functions HOT 9
- Enforce underscore for internal or private functions HOT 1
- Low sensitivity of explicit-types HOT 3
- Can't install solhint through yarn/npm package manager HOT 2
- e2e tests to fixable rules and store report to file (?)
- Make custom-errors rules check only from version it appearead HOT 1
- Allow Solhint report to be exported to file HOT 1
- The comprehensive-interface rule results in compiler warning: Interface functions are implicitly "virtual" HOT 7
- Add an official docker image for solhint HOT 3
- private-vars-leading-underscore on internal functions in libraries is not a best practice HOT 2
- Make fallback functions 'external' HOT 1
- Solhint npm installed executable won't run - throws error "Unexpected Token" HOT 1
- `explicit-types` autofix issues HOT 3
- When throwing ConfigMissingError, keep error message succint HOT 1
- New possible rules to analyze HOT 2
- `gas-indexed-events` not working for Interfaces HOT 2
- False version warning by `gas-custom-errors` rule HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solhint.