Skip to content

Extend capabilities of Foundry formatter to be compatible with Solidity's official style guide #6147

Open
@NouDaimon

Description

@NouDaimon

Component

Forge

Describe the feature you would like

The current settings do not allow to follow the styling guide recommended by SolidityLang docs, especially when it comes to Maximum Line Length editing.

In particular, function parameters cannot be (easily/reliably) formatted as recommended here.

Similarly, the functionality of the formatter is far more constrained than Prettier, leading to repos which want to follow the above guide requiring (almost) unnecessary additional packages.

It would be phenomenal to at the very least have the default settings match the recommendations in the official SolidityLang docs.

Additional context

Example:

Setting line-length to 60:

uint256 debtPriceUSD =
            _oracle.getAssetPrice(address(_assets.debt));

instead of


uint256 debtPriceUSD = _oracle.getAssetPrice(
    address(_assets.debt)
);

or

       ratio = _collateralRatioUSD(
           _loanState.collateralUSD, _loanState.debtUSD
       );

versus:

        ratio = _collateralRatioUSD(
            _loanState.collateralUSD, 
            _loanState.debtUSD
        );

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions