placemark/togeojson

View on GitHub

Showing 10 of 24 total issues

Function getLap has a Cognitive Complexity of 37 (exceeds 10 allowed). Consider refactoring.
Open

function getLap(node: Element): Feature | null {
  const segments = $(node, "Track");
  const track = [];
  const times = [];
  const heartRates = [];
Severity: Minor
Found in lib/tcx.ts - About 4 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 getGeometry has a Cognitive Complexity of 36 (exceeds 10 allowed). Consider refactoring.
Open

export function getGeometry(node: Element): GeometriesAndTimes {
  let geometries: Geometry[] = [];
  let coordTimes: string[][] = [];

  for (let i = 0; i < node.childNodes.length; i++) {
Severity: Minor
Found in lib/kml/geometry.ts - About 4 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 getTrack has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

function getTrack(node: Element): Feature<LineString | MultiLineString> | null {
  const segments = $(node, "trkseg");
  const track = [];
  const times = [];
  const extractedLines = [];
Severity: Minor
Found in lib/gpx.ts - 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 getGeometry has 67 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export function getGeometry(node: Element): GeometriesAndTimes {
  let geometries: Geometry[] = [];
  let coordTimes: string[][] = [];

  for (let i = 0; i < node.childNodes.length; i++) {
Severity: Major
Found in lib/kml/geometry.ts - About 1 hr to fix

    Function getLap has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    function getLap(node: Element): Feature | null {
      const segments = $(node, "Track");
      const track = [];
      const times = [];
      const heartRates = [];
    Severity: Major
    Found in lib/tcx.ts - About 1 hr to fix

      Function kmlWithFolders has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring.
      Open

      export function kmlWithFolders(
        node: Document,
        options: KMLOptions = {
          skipNullGeometry: false,
        }
      Severity: Minor
      Found in lib/kml.ts - 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

      Function getTrack has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      function getTrack(node: Element): Feature<LineString | MultiLineString> | null {
        const segments = $(node, "trkseg");
        const track = [];
        const times = [];
        const extractedLines = [];
      Severity: Major
      Found in lib/gpx.ts - About 1 hr to fix

        Function getPoints has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

        function getPoints(node: Element) {
          const pts = $(node, "Trackpoint");
          const line: Position[] = [];
          const times = [];
          const heartRates = [];
        Severity: Minor
        Found in lib/tcx.ts - About 55 mins 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 getPoints has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

        function getPoints(node: Element, pointname: "trkpt" | "rtept") {
          const pts = $(node, pointname);
          const line: Position[] = [];
          const times = [];
          const extendedValues: P = {};
        Severity: Minor
        Found in lib/gpx.ts - About 55 mins 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 deeply nested control flow statements.
        Open

                    if (ring.length >= 4) {
                      coords.push(ring);
                    }
        Severity: Major
        Found in lib/kml/geometry.ts - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language