LuciferYang commented on code in PR #46947:
URL: https://github.com/apache/spark/pull/46947#discussion_r1637426315


##########
scalastyle-config.xml:
##########
@@ -155,6 +155,14 @@ This file is divided into 3 sections:
     <customMessage><![CDATA[MDC should be used in string interpolation 
log"..." instead of s"..."]]></customMessage>
   </check>
 
+  <check customId="logInlineVariable" level="error" 
class="org.scalastyle.file.RegexChecker" enabled="true">
+    <parameters><parameter 
name="regex">log(?:Info|Warning|Error)\(s".*(\$|\+\s*[^\s"]).*"\)</parameter></parameters>

Review Comment:
   > Also, need to exclude the testing code.
   
   This might be difficult, as for scalastyle-maven-plugin, there is currently 
no mechanism similar to Java checkstyle's SuppressionFilter that can ignore 
certain rules in specific files or code blocks. The rule ignoring of scalastyle 
is global and cannot be targeted at specific files or code blocks. After 
defining the check rule, we may only be able to skip the relevant checks in a 
way similar to the following:
   
   ```
   // scalastyle:off logInlineVariable
   logInfo(s"....")
   // scalastyle:on logInlineVariable
   ```



-- 
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