Pure JSP Comments can decrease Costs

CostSoftware AgilityEmbedded Documentation

Pure JSP Comments can decrease Costs

This code insight counts one violation each time a scriptlet contains only java comments.

This includes for example the following patterns :

<% /** … */ %>
<% /* … */ %>
<% // … %>

Including cases with several comments:

<% /* … */
/* … */
%>

And of course cases using XML format tags:

<jsp:scriptlet> /* …*/ </jsp:scriptlet>

5362

Why you should care

Java comments are for commenting java code. If a JSP scriptlet contains no java code, then no java comment is needed. A scriptlet containing only java comment is symptomatic of :

  • a comment aiming to produce documentation at JSP script level. In this case a JSP comment would be more appropriated.
  • a commented out java code: this is a bad practice because useless code should be removed.

so <%– … %> is prefered to

<% /** … */ %>
<% /* … */ %>
<% // … %>

Business Impacts

Cost

CAST recommendations

References

https://www.quantifiedcode.com/knowledge-base/readability/Avoid%20%22non-Pythonic%22%20attribute%20names/3ueqPTsn

5362

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

See featuresHow it works