Skip to content

feat(forge lint): create syntax for ignoring a linting rule on a line-level (// forge-lint-ignore: foo-bar-baz) #10769

Open
@zerosnacks

Description

@zerosnacks

Component

Forge

Describe the feature you would like

Currently a syntax like // forge-config: default.lint.exclude_lints = ["mixed-case-variable"] defined on a function level would correctly ignore the lint rule violations defined here but is unwieldy and would override all exclusive lints defined on a global level rather than be additive.

// forge-config: default.lint.exclude_lints = ["mixed-case-variable"]
contract StdCheatsForkTest is Test {
    MockUSDT public USDT;
    MockUSDC public USDC;
}

There are cases like this where line level ignoring also makes sense:

note[screaming-snake-case-const]: constants should use SCREAMING_SNAKE_CASE
   --> /forge-std/src/StdCheats.sol:656:25
    |
656 |     Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));

We should have a syntax, preferably short like: // forge-lint-ignore: mixed-case-variable to ignore and a // forge-lint: mixed-case-variable to enable selectively.

Additionally we should optionally accept an array // forge-lint-ignore: [mixed-case-variable, foo-bar, bar-baz] syntax and a // forge-lint: [mixed-case-variable, foo-bar, bar-baz] to enable / ignore multiple.

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Ready For Review

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions