Giter VIP home page Giter VIP logo

Comments (6)

dbale-altoros avatar dbale-altoros commented on May 26, 2024

@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.

CJ42 avatar CJ42 commented on May 26, 2024

This release suggests that this option exist

https://github.com/protofire/solhint/releases/tag/3.5.1

image

from solhint.

dbale-altoros avatar dbale-altoros commented on May 26, 2024

omg!
That is weird
I'll check that asap
@CJ42 sorry for the bad response

from solhint.

dbale-altoros avatar dbale-altoros commented on May 26, 2024

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.

CJ42 avatar CJ42 commented on May 26, 2024

@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.

dbale-altoros avatar dbale-altoros commented on May 26, 2024

yes will do

from solhint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.