fix: add braces to one-line if statements in ERC721EnumerableFacet#242
Merged
mudgen merged 1 commit intoPerfect-Abstractions:mainfrom Dec 5, 2025
Conversation
Fix style guide violation by adding braces around one-line if statements that call revert. This ensures compliance with Compose's coding standards which require all if statements to use braces. Fixes two instances in safeTransferFrom functions (lines 331 and 354).
👷 Deploy request for compose-diamonds pending review.Visit the deploys page to approve it
|
Coverage Report
Last updated: Fri, 05 Dec 2025 07:27:21 GMT for commit |
Gas ReportNo gas usage changes detected between All functions maintain the same gas costs. ✅ Last updated: Fri, 05 Dec 2025 07:28:11 GMT for commit |
Contributor
|
@panditdhamdhere Thanks for this! |
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.
Fix style guide violation by adding braces around one-line if statements that call revert. This ensures compliance with Compose's coding standards which require all if statements to use braces.
Fixes two instances in safeTransferFrom functions (lines 331 and 354).
Summary
This PR fixes a style guide violation in
ERC721EnumerableFacet.solwhere two one-line if statements were missing braces around their revert calls. According to Compose's style guide (STYLE.md and banned-solidity-features.mdx), all if statements must use braces, even for single-line statements.Changes Made
if (reason.length == 0) revert ERC721InvalidReceiver(_to);in thesafeTransferFrom(address, address, uint256)functionif (reason.length == 0) revert ERC721InvalidReceiver(_to);in thesafeTransferFrom(address, address, uint256, bytes)functionforge fmtto ensure proper formattingBoth instances were in the error handling catch blocks of the safe transfer functions, where empty revert reasons are checked before propagating the original revert reason.
Checklist
Code follows the Solidity feature ban - No inheritance, constructors, modifiers, public/private variables, external library functions,
using fordirectives, orselfdestructCode follows Design Principles - Readable, uses diamond storage, favors composition over inheritance
Code matches the codebase style - Consistent formatting, documentation, and patterns (e.g. ERC20Facet.sol)
Code is formatted with
forge fmt- ✅ Formatted withforge fmtExisting tests pass - ✅ All 38 tests in
ERC721EnumerableFacet.t.solpassNew tests are optional - N/A - This is a style fix, no functional changes
All tests pass - ✅ Verified with
forge test --match-path "test/token/ERC721/ERC721Enumerable/ERC721EnumerableFacet.t.sol"(38 tests passed)Documentation updated - N/A - No documentation changes needed for style fixes
Additional Notes
banned-solidity-features.mdx)