Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor body idents too many levels #78

Open
clarkhenry opened this issue Oct 9, 2021 · 1 comment
Open

Constructor body idents too many levels #78

clarkhenry opened this issue Oct 9, 2021 · 1 comment

Comments

@clarkhenry
Copy link
Contributor

clarkhenry commented Oct 9, 2021

When using a constructor with many arguments, such that each argument should drop to its own line, the body of the constructor has too many levels of indentation.

The same is not true of a function having the same arguments. That is, functions still format the body correctly, regardless of the style of the function declaration.

The following code demonstrates the issue with the style/format of the constructor:

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";


contract SolidityModeExample {

    IERC20 public tokenA;
    IERC20 public tokenB;
    IERC20 public tokenC;
    IERC20 public tokenD;

    /// @dev The body of this constructor is indented too far, by 8 spaces
    constructor (
        address _tokenA,
        address _tokenB,
        address _tokenC,
        address _tokenD
    )
        public
            {
                tokenA = IERC20(_tokenA);
                tokenB = IERC20(_tokenB);
                tokenC = IERC20(_tokenC);
                tokenD = IERC20(_tokenD);
            }

    /// @dev The body of this function is indented correctly
    function updateTokens (
        address _tokenA,
        address _tokenB,
        address _tokenC,
        address _tokenD
    )
        public
    {
        tokenA = IERC20(_tokenA);
        tokenB = IERC20(_tokenB);
        tokenC = IERC20(_tokenC);
        tokenD = IERC20(_tokenD);
    }
}
@hellwolf
Copy link

hellwolf commented Jan 3, 2023

yea, the whole indentation of this mode makes little sense so far..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants