niwa99/Tower-Defense

View on GitHub
app/src/main/java/de/dhbw/map/objects/bullet/LaserRay.java

Summary

Maintainability
A
2 hrs
Test Coverage

Method doIntersect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
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);
Severity: Minor
Found in app/src/main/java/de/dhbw/map/objects/bullet/LaserRay.java - About 1 hr to fix

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

        return false; // Doesn't fall in any of the above cases
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/bullet/LaserRay.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            if (o4 == 0 && onSegment(p2, q1, q2)) return true;
    Severity: Major
    Found in app/src/main/java/de/dhbw/map/objects/bullet/LaserRay.java - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status