This is an automated email from the ASF dual-hosted git repository.

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new e8d5a1558e1 Enforce non-final for-loop variables with Checkstyle 
(#39731)
e8d5a1558e1 is described below

commit e8d5a1558e17db9646398d21fbec1aaa3032775c
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Sep 5 11:50:45 2026 +0800

    Enforce non-final for-loop variables with Checkstyle (#39731)
    
    * Add defensive code checks to coding standards skill
    
    * Enforce non-final for-loop variables with Checkstyle
---
 src/resources/checkstyle.xml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index c0a833abff9..db0c64f7e13 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -127,6 +127,10 @@
                       
value="//METHOD_DEF[./MODIFIERS/ANNOTATION[(./IDENT[@text='Test'] or 
./DOT/IDENT[@text='Test'] or ./IDENT[@text='ParameterizedTest'] or 
./DOT/IDENT[@text='ParameterizedTest'] or ./IDENT[@text='RepeatedTest'] or 
./DOT/IDENT[@text='RepeatedTest'] or ./IDENT[@text='TestFactory'] or 
./DOT/IDENT[@text='TestFactory'] or ./IDENT[@text='TestTemplate'] or 
./DOT/IDENT[@text='TestTemplate'])] and not(./IDENT[starts-with(@text, 
'assert')])]" />
             <message key="matchxpath.match" value="Test method names must 
start with 'assert'." />
         </module>
+        <module name="MatchXpath">
+            <property name="query" value="//VARIABLE_DEF[./MODIFIERS/FINAL and 
(parent::FOR_INIT or parent::FOR_EACH_CLAUSE)]" />
+            <message key="matchxpath.match" value="Do not declare for-loop 
variables as final." />
+        </module>
         <module name="IllegalType" />
         <module name="IllegalType">
             <property name="tokens" value="IMPORT, PARAMETER_DEF" />

Reply via email to