Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
Very often we see pull requests that added println from debugging, but the author forgot to remove it before code review.
We can use the regex checker to disallow println. For legitimate use of println, we can then disable the rule where they are used.
Add to scalastyle-config.xml file:
<check customId="println" level="error" class="org.scalastyle.scalariform.TokenChecker" enabled="true"> <parameters><parameter name="regex">^println$</parameter></parameters> <customMessage><![CDATA[Are you sure you want to println? If yes, wrap the code block with // scalastyle:off println println(...) // scalastyle:on println]]></customMessage> </check>