louisdh/bezierpath-length

View on GitHub

Showing 8 of 88 total issues

Function point has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    func point(at percent: CGFloat, with elements: [PathElement]) -> CGPoint? {

        if percent < 0.0 || percent > 1.0 {
            return nil
        }
Severity: Minor
Found in Source/BezierPath+Length.swift - About 5 hrs 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

Function point has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func point(at percent: CGFloat, with elements: [PathElement]) -> CGPoint? {

        if percent < 0.0 || percent > 1.0 {
            return nil
        }
Severity: Major
Found in Source/BezierPath+Length.swift - About 3 hrs to fix

    Function getLength has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        func getLength(with elements: [PathElement]) -> CGFloat {
    
            var firstPointInSubpath: CGPoint?
    
            /// Holds current point on the path (must never be a control point)
    Severity: Minor
    Found in Source/BezierPath+Length.swift - About 2 hrs 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

    Function getLength has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func getLength(with elements: [PathElement]) -> CGFloat {
    
            var firstPointInSubpath: CGPoint?
    
            /// Holds current point on the path (must never be a control point)
    Severity: Minor
    Found in Source/BezierPath+Length.swift - About 1 hr to fix

      Function cubicCurvePoint has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          func cubicCurvePoint(t: CGFloat, p0: CGPoint, c1: CGPoint, c2: CGPoint, p1: CGPoint) -> CGPoint {
      Severity: Minor
      Found in Source/BezierPath+Length.swift - About 35 mins to fix

        Function cubicCurveValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            func cubicCurveValue(t: CGFloat, p0: CGFloat, c1: CGFloat, c2: CGFloat, p1: CGFloat) -> CGFloat {
        Severity: Minor
        Found in Source/BezierPath+Length.swift - About 35 mins to fix

          Avoid too many return statements within this function.
          Open

                  return nil
          Severity: Major
          Found in Source/BezierPath+Length.swift - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                    return linearPoint(t: t, p0: p0, p1: p1)
            Severity: Major
            Found in Source/BezierPath+Length.swift - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language