TargetProcess/tauCharts

View on GitHub
src/utils/path/interpolators/step.ts

Summary

Maintainability
F
3 days
Test Coverage

Function getStepLine has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getStepLine(points: Point[]) {
    var result: Point[] = [];
    var hasId = (points[0].id !== undefined);
    var hasSize = (points[0].size !== undefined);
    for (var i = 1, p0, p1, m0, m1; i < points.length; i++) {
Severity: Minor
Found in src/utils/path/interpolators/step.ts - About 1 hr to fix

    Function getStepBeforeLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getStepBeforeLine(points: Point[]) {
        var result: Point[] = [];
        var hasId = (points[0].id !== undefined);
        var hasSize = (points[0].size !== undefined);
        for (var i = 1, p0, p1, m; i < points.length; i++) {
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts - About 35 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 getStepAfterLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getStepAfterLine(points: Point[]) {
        var result: Point[] = [];
        var hasId = (points[0].id !== undefined);
        var hasSize = (points[0].size !== undefined);
        for (var i = 1, p0, p1, m; i < points.length; i++) {
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts - About 35 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 getStepLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getStepLine(points: Point[]) {
        var result: Point[] = [];
        var hasId = (points[0].id !== undefined);
        var hasSize = (points[0].size !== undefined);
        for (var i = 1, p0, p1, m0, m1; i < points.length; i++) {
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts - About 35 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function getStepAfterLine(points: Point[]) {
        var result: Point[] = [];
        var hasId = (points[0].id !== undefined);
        var hasSize = (points[0].size !== undefined);
        for (var i = 1, p0, p1, m; i < points.length; i++) {
    Severity: Major
    Found in src/utils/path/interpolators/step.ts and 1 other location - About 1 day to fix
    src/utils/path/interpolators/step.ts on lines 34..57

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 260.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function getStepBeforeLine(points: Point[]) {
        var result: Point[] = [];
        var hasId = (points[0].id !== undefined);
        var hasSize = (points[0].size !== undefined);
        for (var i = 1, p0, p1, m; i < points.length; i++) {
    Severity: Major
    Found in src/utils/path/interpolators/step.ts and 1 other location - About 1 day to fix
    src/utils/path/interpolators/step.ts on lines 59..82

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 260.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var hasId = (points[0].id !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'hasSize' is never reassigned; use 'const' instead of 'var'.
    Open

        var hasSize = (points[0].size !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'result' is never reassigned; use 'const' instead of 'var'.
    Open

        var result: Point[] = [];
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var hasId = (points[0].id !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'hasSize' is never reassigned; use 'const' instead of 'var'.
    Open

        var hasSize = (points[0].size !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var hasSize = (points[0].size !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'hasId' is never reassigned; use 'const' instead of 'var'.
    Open

        var hasId = (points[0].id !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'hasSize' is never reassigned; use 'const' instead of 'var'.
    Open

        var hasSize = (points[0].size !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        for (var i = 1, p0, p1, m; i < points.length; i++) {
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var hasSize = (points[0].size !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var hasId = (points[0].id !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var result: Point[] = [];
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var result: Point[] = [];
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var hasSize = (points[0].size !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        var result: Point[] = [];
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'result' is never reassigned; use 'const' instead of 'var'.
    Open

        var result: Point[] = [];
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        for (var i = 1, p0, p1, m; i < points.length; i++) {
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    Identifier 'hasId' is never reassigned; use 'const' instead of 'var'.
    Open

        var hasId = (points[0].id !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'hasId' is never reassigned; use 'const' instead of 'var'.
    Open

        var hasId = (points[0].id !== undefined);
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'result' is never reassigned; use 'const' instead of 'var'.
    Open

        var result: Point[] = [];
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Forbidden 'var' keyword, use 'let' or 'const' instead
    Open

        for (var i = 1, p0, p1, m0, m1; i < points.length; i++) {
    Severity: Minor
    Found in src/utils/path/interpolators/step.ts by tslint

    Rule: no-var-keyword

    Disallows usage of the var keyword.

    Use let or const instead.

    Rationale

    Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

    Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

    Notes
    • Has Fix

    Config

    Not configurable.

    Examples
    "no-var-keyword": true

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status