ITADN

Allow interface function names in `SNAKE_CASE` when they represent constant values

#699Closedsmol-ninja 创建于 2025-07-29
S
smol-ninjacommented
### Problem Consider the following example: ```solidity interface IA { /// @dev This is a constant state variable. function START_TIME() external view returns (uint256); } contract A is IA { /// @inheritdoc IA uint256 public constant override START_TIME = 1; } ``` The `func-name-mixedcase` rule currently throws an error for the above example. However, this is a valid naming convention when the function returns a constant value. The same for immutables. ### Solution I believe there are two possible approaches to address this: 1. **Conditional exemption**: Ignore `SNAKE_CASE` function names in interface files when they represent constant values (e.g., when documented as constants or immutables in natspecs). 2. **New rule**: Add a complementary rule like `const-func-name-snakecase` that enforces constant/immutable function names to be in `SNAKE_CASE`.
关闭于 2025-08-15 6 条评论