AEMaaCS Code Scanning Issues - Open Issues - Use Interface com.day.cq.wcm.api.NameConstant - Use predefined constant instead of hardcoded value.
Hi AEM Community,
When running a cloud deployment, We are getting the number of open issues to be numbered 5 as shown below -
| Issue |
| Use constant NN_TEMPLATE from interface com.day.cq.wcm.api.NameConstants instead of hardcoded value. |
| Rule |
| AEM Rules:AEM-2 |
As per documentation link - https://github.com/wttech/AEM-Rules-for-SonarQube#good-practices
-
AEM-2 Use predefined constant instead of hardcoded value.
- Use constants available in AEM instead of repeating inline literals.
The issue is reported because of the below - We are declaring cq:template as a constant in our Constants file separately while it is available out of the box in the above mentioned interface.
public static final String CQ_TEMPLATE = "cq:template";
However, when using the interface NameConstants as suggested, The IDE reports the below -


The below interface is thus suggested.
import com.day.cq.wcm.api.constants.NameConstants;
However, this interface is not being resolved by the IDE (IntelliJ).

How can we resolve this minor code smell issue when the suggested interface is deprecated ?
@arunpatidar, @mohit_kbansal, @kautuk_sahni, @b_sravan, @theo_pendle
Thanks,
Rohan Garg