Open PaulRBerg opened 1 year ago
Another example, with function calls:
contract NotSoPretty {
function foo() public pure {
uint256 baz;
// These lines have length 121
baz = bar(1111111111111111111111111111111111111111111111111111111111, 11111111111111111111111111111111111111111);
baz =
bar(111111111111111111111111111111111111111111111111111111111111111, 11111111111111111111111111111111111111);
bar(1111111111111111111111111111111111111111111111111111, 11111111111111111111111111111111111111111111111111111);
// Extend the lines to 122 and they finally break
baz =
bar(1111111111111111111111111111111111111111111111111111111111, 111111111111111111111111111111111111111110);
baz = bar(
111111111111111111111111111111111111111111111111111111111111111, 111111111111111111111111111111111111110
);
bar(
1111111111111111111111111111111111111111111111111111, 111111111111111111111111111111111111111111111111111110
);
}
function bar(uint256, uint256) private pure returns (uint256) {
return 0;
}
}
I have faced this same issue with lines being 121 characters long and forge fmt
doesn't format it to 120 lines. But if I change the line_length = 119
it doesn work and change it to under 119 characters. It seems highly unpredictable
Component
Forge
Describe the feature you would like
As discussed here with @mds1, it would be helpful to be able to make
line_length
a hard requirement. At the moment,forge fmt
will leave untouched those statements that exceed the line length by 1 or 2 characters. For instance:This line has 121 lines, but I have set the
line_length
to 1.This is problematic because other Solidity linting tools (e.g. Solhint) consider the
max-line-length
rule to be a hard requirement.