feat(lint): add require-revert-in-loop detector#15236
Merged
mablr merged 6 commits intoJun 26, 2026
Merged
Conversation
mablr
approved these changes
Jun 22, 2026
mablr
left a comment
Member
There was a problem hiding this comment.
Fixed clippy warning + Added coverage.
Seems good, thank you @Berektassuly!
Contributor
Author
|
Opened the matching Foundry Book docs PR here: foundry-rs/book#1911 This should address the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Refs #14381.
Adds the
require-revert-in-loopdetector from the lint parity checklist. A single failingrequireorrevertinside a loop can revert the entire batch, so surfacing these cases helps users review whether validation should happen before the loop, skip invalid entries, or split work into separate calls.Solution
Adds a low-severity Solidity lint for
requirecalls andrevertstatements executed in loop context. The detector covers direct loop bodies, internal helper calls reached from loops, modifier placeholder execution inside loops, and inline assemblyrevert.The shared loop-context visitor now exposes both statements and expressions so this lint can reuse the same internal-call and modifier traversal already used by loop-related lints, while avoiding duplicate reports for helpers that introduce their own loops and are called from outside a loop.
Validation
Tests pass:
cargo test -p forge --test ui -- RequireRevertInLoopPR Checklist