Remove code statement from for loop block…
for( UIComponent currentMenuItemComponent : menuBarComponent.getChildren() ) {
String style = "";
String selectedViewName = ( String )currentMenuItemComponent.getAttributes().get( ATTRIBUTE_View );
logger.info( "Value of selectedViewName =" + selectedViewName );
if( selectedViewName.equals( targetView ) ) {
style = "selected";
logger.info( "Value of style =" + style );
}
I want to remove logger.info statements from for loop block. Is this possible ?
I have already used the expression
(if|else)(.*)(\r?\n)([\s-]*)(logger.info)(\( \")(.*)(\" \);)
to remove them from if statements in Notepad++. I am looking for a way to remover from the for block
Update: If possible with a python script please help me out.
This is very similar to the other question you asked on locating
System.out.printlnhere: Remove System.out statements from For Loops blocks only.Referring to my answer, the only difference is the PMD query is different. Here is the new one:
Replace the other query in the
<![CDATA[ ... ]]>element incustom.xmlin my answer. All other steps are the same.