Method compareVersion
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public static final int compareVersion(int[] v1, int[] v2) {
for (int j = 0;; ++j) {
if (j == v1.length) {
for (; j < v2.length; ++j) {
if (v2[j] > 0) return -1;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method convertSubversion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static final int convertSubversion(String subver) {
try {
return Integer.parseInt(subver);
} catch (Throwable ex) { //eat
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Consider simplifying this complex logical expression. Open
if ((cc < '0' || cc > '9') && (cc < 'a' || cc > 'z')
&& (cc < 'A' || cc > 'Z'))
break;
Method nextVerSeparator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static final int nextVerSeparator(String version, int from) {
for (final int len = version.length(); from < len; ++from) {
final char cc = version.charAt(from);
if ((cc < '0' || cc > '9') && (cc < 'a' || cc > 'z')
&& (cc < 'A' || cc > 'Z'))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
if (v1[j] < 0) return -1;
Avoid too many return
statements within this method. Open
if (v1[j] > v2[j]) return 1;
Avoid too many return
statements within this method. Open
if (v1[j] < v2[j]) return -1;
Avoid too many return
statements within this method. Open
return 0;