JSP Code Metrics
Rules available in this category:
- Maximum_number_of_public_methods
- Maximum_number_of_private_methods
- Maximum_number_of_methods
- Maximum_number_of_package_private_methods
- Maximum_number_of_protected_methods
- Maximum_number_of_public_fields
- Maximum_number_of_fields
- Maximum_number_of_private_fields
- Maximum_number_of_package_private_fields
- Maximum_number_of_protected_fields
Rule 1: Maximum_number_of_public_methods
Severity:
Medium
Rule:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Reason:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Usage Example:
<%!
public void addNumbers(int n1, int n2)
{
...
}
public void subNumbers(int n1, int n2)
{
...
}
public void divNumbers(int n1, int n2)
{
...
}
public void multNumbers(int n1, int n2)
{
...
}
public void pow(int n1, int n2)
{
...
}
public void root(int n1, int n2)
{
...
}
public void sin(int n1, int n2)
{
...
}
public void cos(int n1, int n2)
{
...
}
public void tan(int n1, int n2)
{
...
}
public void percent(int n1, int n2)
{
...
}
public void limit(int n1, int n2) // 11TH METHOD. EXCEED LIMIT
{
...
}
%>
Should be written as:
Reference:
No references available.
Rule 2: Maximum_number_of_private_methods
Severity:
Medium
Rule:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Reason:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Usage Example:
<%!
private void addNumbers(int n1, int n2)
{
...
}
private void subNumbers(int n1, int n2)
{
...
}
private void divNumbers(int n1, int n2)
{
...
}
private void multNumbers(int n1, int n2)
{
...
}
private void pow(int n1, int n2)
{
...
}
private void root(int n1, int n2)
{
...
}
private void sin(int n1, int n2)
{
...
}
private void cos(int n1, int n2)
{
...
}
private void tan(int n1, int n2)
{
...
}
private void percent(int n1, int n2)
{
...
}
private void limit(int n1, int n2) // 11TH METHOD. EXCEED LIMIT
{
...
}
%>
Should be written as:
Reference:
No references available.
Rule 3: Maximum_number_of_methods
Severity:
Medium
Rule:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Reason:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Usage Example:
<%!
private void addNumbers(int n1, int n2)
{
...
}
public void subNumbers(int n1, int n2)
{
...
}
private void divNumbers(int n1, int n2)
{
...
}
public void multNumbers(int n1, int n2)
{
...
}
protected void pow(int n1, int n2)
{
...
}
public void root(int n1, int n2)
{
...
}
public void sin(int n1, int n2)
{
...
}
void cos(int n1, int n2)
{
...
}
public void tan(int n1, int n2)
{
...
}
public void percent(int n1, int n2)
{
...
}
void limit(int n1, int n2) // 11TH METHOD. EXCEED LIMIT
{
...
}
%>
Should be written as:
Reference:
No references available.
Rule 4: Maximum_number_of_package_private_methods
Severity:
Medium
Rule:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Reason:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Usage Example:
<%!
void addNumbers(int n1, int n2)
{
...
}
void subNumbers(int n1, int n2)
{
...
}
void divNumbers(int n1, int n2)
{
...
}
void multNumbers(int n1, int n2)
{
...
}
void pow(int n1, int n2)
{
...
}
void root(int n1, int n2)
{
...
}
void sin(int n1, int n2)
{
...
}
void cos(int n1, int n2)
{
...
}
void tan(int n1, int n2)
{
...
}
void percent(int n1, int n2)
{
...
}
void limit(int n1, int n2) // 11TH METHOD. EXCEED LIMIT
{
...
}
%>
Should be written as:
Reference:
No references available.
Rule 5: Maximum_number_of_protected_methods
Severity:
Medium
Rule:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Reason:
The number of methods in a JSP indicates the amount of functionality implemented by a JSP.
Usage Example:
<%!
protected void addNumbers(int n1, int n2)
{
...
}
protected void subNumbers(int n1, int n2)
{
...
}
protected void divNumbers(int n1, int n2)
{
...
}
protected void multNumbers(int n1, int n2)
{
...
}
protected void pow(int n1, int n2)
{
...
}
protected void root(int n1, int n2)
{
...
}
protected void sin(int n1, int n2)
{
...
}
protected void cos(int n1, int n2)
{
...
}
protected void tan(int n1, int n2)
{
...
}
protected void percent(int n1, int n2)
{
...
}
protected void limit(int n1, int n2) // 11TH METHOD. EXCEED LIMIT
{
...
}
%>
Should be written as:
Reference:
No references available.
Rule 6: Maximum_number_of_public_fields
Severity:
Medium
Rule:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Reason:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Usage Example:
<%!
public int fld1 = 0;
public int fld2 = 0;
public int fld3 = 0;
public int fld4 = 0;
public int fld5 = 0;
public int fld6 = 0;
public int fld7 = 0;
public int fld8 = 0;
public int fld9 = 0;
public int fld10 = 0;
public int fld11 = 0; // VIOLATION
%>
Should be written as:
Reference:
No references available.
Rule 7: Maximum_number_of_fields
Severity:
Medium
Rule:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Reason:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Usage Example:
<%!
public int fld1 = 0;
public int fld2 = 0;
protected int fld3 = 0;
int fld4 = 0;
public int fld5 = 0;
protected int fld6 = 0;
private int fld7 = 0;
public int fld8 = 0;
private int fld9 = 0;
int fld10 = 0;
public int fld11 = 0; // VIOLATION
%>
Should be written as:
Reference:
No references available.
Rule 8: Maximum_number_of_private_fields
Severity:
Medium
Rule:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Reason:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Usage Example:
<%!
private int fld1 = 0;
private int fld2 = 0;
private int fld3 = 0;
private int fld4 = 0;
private int fld5 = 0;
private int fld6 = 0;
private int fld7 = 0;
private int fld8 = 0;
private int fld9 = 0;
private int fld10 = 0;
private int fld11 = 0; // VIOLATION
%>
Should be written as:
Reference:
No references available.
Rule 9: Maximum_number_of_package_private_fields
Severity:
Medium
Rule:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Reason:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Usage Example:
<%!
int fld1 = 0;
int fld2 = 0;
int fld3 = 0;
int fld4 = 0;
int fld5 = 0;
int fld6 = 0;
int fld7 = 0;
int fld8 = 0;
int fld9 = 0;
int fld10 = 0;
int fld11 = 0; // VIOLATION
%>
Should be written as:
Reference:
No references available.
Rule 10: Maximum_number_of_protected_fields
Severity:
Medium
Rule:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Reason:
The number of fields in a JSP file indicates the amount of data the JSP file must maintain in order to carry out its responsibilities.
Usage Example:
<%!
protected int fld1 = 0;
protected int fld2 = 0;
protected int fld3 = 0;
protected int fld4 = 0;
protected int fld5 = 0;
protected int fld6 = 0;
protected int fld7 = 0;
protected int fld8 = 0;
protected int fld9 = 0;
protected int fld10 = 0;
protected int fld11 = 0; // VIOLATION
%>
Should be written as:
Reference:
No references available.