flut1/knockout-validator

View on GitHub
src/lib/fields/FieldCollection.ts

Summary

Maintainability
A
2 hrs
Test Coverage

Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    constructor()
    {
        super();

        this.isValidated = ko.pureComputed(() =>
Severity: Minor
Found in src/lib/fields/FieldCollection.ts - About 1 hr to fix

    Function constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        constructor()
        {
            super();
    
            this.isValidated = ko.pureComputed(() =>
    Severity: Minor
    Found in src/lib/fields/FieldCollection.ts - About 45 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 validateOn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public set validateOn(validateOn:string)
        {
            if(this._validateOn !== validateOn)
            {
                this._autoValidate = false;
    Severity: Minor
    Found in src/lib/fields/FieldCollection.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

    Unnecessary semicolon
    Open

        };
    Severity: Minor
    Found in src/lib/fields/FieldCollection.ts by tslint

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    Unnecessary semicolon
    Open

        };
    Severity: Minor
    Found in src/lib/fields/FieldCollection.ts by tslint

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status