dramaticlly commented on code in PR #19323:
URL: https://github.com/apache/iceberg/pull/19323#discussion_r4805249413


##########
AGENTS.md:
##########
@@ -195,6 +195,7 @@ CloseableIterable<FileScanTask> planFiles();
 - Use `@ParameterizedTest` instead of looping over inputs; a loop hides which 
input failed and skips the rest.
 - If a few inputs expect a different outcome, branch on the input rather than 
adding a separate test.
 - JUnit 5 + AssertJ: `@Test`, `assertThat`, `assertThatThrownBy`.
+- Pass format arguments directly to AssertJ message assertions and 
descriptions: `hasMessage("Invalid %s", value)` and `as("Invalid %s", value)`, 
not `hasMessage(String.format("Invalid %s", value))`.

Review Comment:
   curious, would checkStyle rule help catch this better? Something like 
existing RegexpMultiline with 
   
   ```xml
   <module name="RegexpMultiline">
       <property name="id" value="AssertJFormatArgs"/>
       <property name="fileExtensions" value="java"/>
       <property name="matchAcrossLines" value="true"/>
       <property name="format" 
value="(?:\.(?:as|describedAs|withFailMessage|overridingErrorMessage|hasMessage(?:Containing|StartingWith|EndingWith)?|hasRootCauseMessage|hasStackTraceContaining|withMessage(?:Containing|StartingWith|EndingWith)?|withStackTraceContaining)|(?&lt;![\w.])fail)\(\s*String\.format\s*\((?!\s*Locale)"/>
       <property name="message" value="Pass format arguments directly to 
AssertJ instead of wrapping with String.format"/>
   </module>
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to