app/src/main/java/de/dhbw/map/objects/bullet/LaserRay.java
Method doIntersect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
static boolean doIntersect(Position p1, Position q1, Position p2, Position q2) {
// Find the four orientations needed for general and
// special cases
int o1 = orientation(p1, q1, p2);
int o2 = orientation(p1, q1, q2);
- 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
Open
return false; // Doesn't fall in any of the above cases
Avoid too many return
statements within this method. Open
Open
if (o4 == 0 && onSegment(p2, q1, q2)) return true;