Inspect nested loops.
Apply with the Grit CLI
grit apply NestedLoop
Matches a simple nested loop
BEFORE
// SPDX-License-Identifier: MIT // compiler version must be greater than or equal to 0.8.13 and less than 0.9.0 pragma solidity ^0.8.9; contract HelloWorld { string public greet = "Hello World!"; function foo(string memory _greet) public { while(other) { greet = foo(bar); while(foo) { greet = foo(bar); } } } }
AFTER
// SPDX-License-Identifier: MIT // compiler version must be greater than or equal to 0.8.13 and less than 0.9.0 pragma solidity ^0.8.9; contract HelloWorld { string public greet = "Hello World!"; function foo(string memory _greet) public { while(other) { greet = foo(bar); while(foo) { greet = foo(bar); } } } }