VictorGa/LightCinematic

View on GitHub

Showing 381 of 381 total issues

Function prepareFrames has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private prepareFrames():void
    {
        this._frames = [];
        let spritesheetIndex:number = 0;
        let multispriteCounter:number = 0;
Severity: Minor
Found in src/lib/LightCinematic.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 exports has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (config)
{
    config.set({

        // base path that will be used to resolve all patterns (eg. files, exclude)
Severity: Minor
Found in karma.conf.js - About 1 hr to fix

    Function prepareFrames has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private prepareFrames():void
        {
            this._frames = [];
            let spritesheetIndex:number = 0;
            let multispriteCounter:number = 0;
    Severity: Minor
    Found in src/lib/LightCinematic.ts - About 1 hr to fix

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

          public draw():void
          {
              if(!this._completed && this._properties.loop === 0)
              {
                  this._properties.onComplete && this._properties.onComplete(this);
      Severity: Minor
      Found in src/lib/LightCinematic.ts - About 1 hr to fix

        Function draw has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public draw():void
            {
                if(!this._completed && this._properties.loop === 0)
                {
                    this._properties.onComplete && this._properties.onComplete(this);
        Severity: Minor
        Found in src/lib/LightCinematic.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private update(timestamp:number):void
            {
                if(this._isStopped) return;
                // calc elapsed time since last loop
                var elapsed = timestamp - this._then;
        Severity: Minor
        Found in src/lib/LightManager.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

        missing whitespace
        Open

            onComplete?:(data:LightCinematic)=>void;
        Severity: Minor
        Found in src/lib/ICinematic.ts by tslint

        Rule: whitespace

        Enforces whitespace style conventions.

        Rationale

        Helps maintain a readable, consistent style in your codebase.

        Notes
        • Has Fix

        Config

        Several arguments may be optionally provided:

        • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
        • "check-decl"checks that variable declarations have whitespace around the equals token.
        • "check-operator" checks for whitespace around operator tokens.
        • "check-module" checks for whitespace in import & export statements.
        • "check-separator" checks for whitespace after separator tokens (,/;).
        • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
        • "check-type" checks for whitespace before a variable type specification.
        • "check-typecast" checks for whitespace between a typecast and its target.
        • "check-type-operator" checks for whitespace between type operators | and &.
        • "check-preblock" checks for whitespace before the opening brace of a block.
        • "check-postbrace" checks for whitespace after an opening brace.
        Examples
        "whitespace": true,check-branch,check-operator,check-typecast
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "check-branch",
              "check-decl",
              "check-operator",
              "check-module",
              "check-separator",
              "check-rest-spread",
              "check-type",
              "check-typecast",
              "check-type-operator",
              "check-preblock",
              "check-postbrace"
            ]
          },
          "minLength": 0,
          "maxLength": 11
        }

        For more information see this page.

        " should be '
        Open

        import LightCinematic from "./LightCinematic";
        Severity: Minor
        Found in src/lib/ICinematic.ts by tslint

        Rule: quotemark

        Enforces quote character for string literals.

        Notes
        • Has Fix

        Config

        Five arguments may be optionally provided:

        • "single" enforces single quotes.
        • "double" enforces double quotes.
        • "backtick" enforces backticks.
        • "jsx-single" enforces single quotes for JSX attributes.
        • "jsx-double" enforces double quotes for JSX attributes.
        • "avoid-template" forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if "avoid-escape" is enabled and both single and double quotes are present in the string (the latter option takes precedence).
        • "avoid-escape" allows you to use the "other" quotemark in cases where escaping would normally be required. For example, [true, "double", "avoid-escape"] would not report a failure on the string literal 'Hello "World"'.
        Examples
        "quotemark": true,single,avoid-escape,avoid-template
        "quotemark": true,single,jsx-double
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "single",
              "double",
              "backtick",
              "jsx-single",
              "jsx-double",
              "avoid-escape",
              "avoid-template"
            ]
          },
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        space indentation expected
        Open

            src:Array<HTMLImageElement | HTMLCanvasElement>;
        Severity: Minor
        Found in src/lib/ISpritesheet.ts by tslint

        Rule: indent

        Enforces indentation with tabs or spaces.

        Rationale

        Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

        Notes
        • Has Fix

        Config

        One of the following arguments must be provided:

        • spaces enforces consistent spaces.
        • tabs enforces consistent tabs.

        A second optional argument specifies indentation size:

        • 2 enforces 2 space indentation.
        • 4 enforces 4 space indentation.

        Indentation size is required for auto-fixing, but not for rule checking.

        NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

        Examples
        "indent": true,spaces
        "indent": true,spaces,4
        "indent": true,tabs,2
        Schema
        {
          "type": "array",
          "items": [
            {
              "type": "string",
              "enum": [
                "tabs",
                "spaces"
              ]
            },
            {
              "type": "number",
              "enum": [
                2,
                4
              ]
            }
          ],
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        missing whitespace
        Open

            onComplete?:(data:LightCinematic)=>void;
        Severity: Minor
        Found in src/lib/ICinematic.ts by tslint

        Rule: whitespace

        Enforces whitespace style conventions.

        Rationale

        Helps maintain a readable, consistent style in your codebase.

        Notes
        • Has Fix

        Config

        Several arguments may be optionally provided:

        • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
        • "check-decl"checks that variable declarations have whitespace around the equals token.
        • "check-operator" checks for whitespace around operator tokens.
        • "check-module" checks for whitespace in import & export statements.
        • "check-separator" checks for whitespace after separator tokens (,/;).
        • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
        • "check-type" checks for whitespace before a variable type specification.
        • "check-typecast" checks for whitespace between a typecast and its target.
        • "check-type-operator" checks for whitespace between type operators | and &.
        • "check-preblock" checks for whitespace before the opening brace of a block.
        • "check-postbrace" checks for whitespace after an opening brace.
        Examples
        "whitespace": true,check-branch,check-operator,check-typecast
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "check-branch",
              "check-decl",
              "check-operator",
              "check-module",
              "check-separator",
              "check-rest-spread",
              "check-type",
              "check-typecast",
              "check-type-operator",
              "check-preblock",
              "check-postbrace"
            ]
          },
          "minLength": 0,
          "maxLength": 11
        }

        For more information see this page.

        Identifier 'width' is never reassigned; use 'const' instead of 'let'.
        Open

                            let width = frame.x + this._properties.frames.width;
        Severity: Minor
        Found in src/lib/LightCinematic.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.

        missing whitespace
        Open

            private _completed:boolean = false;
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: whitespace

        Enforces whitespace style conventions.

        Rationale

        Helps maintain a readable, consistent style in your codebase.

        Notes
        • Has Fix

        Config

        Several arguments may be optionally provided:

        • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
        • "check-decl"checks that variable declarations have whitespace around the equals token.
        • "check-operator" checks for whitespace around operator tokens.
        • "check-module" checks for whitespace in import & export statements.
        • "check-separator" checks for whitespace after separator tokens (,/;).
        • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
        • "check-type" checks for whitespace before a variable type specification.
        • "check-typecast" checks for whitespace between a typecast and its target.
        • "check-type-operator" checks for whitespace between type operators | and &.
        • "check-preblock" checks for whitespace before the opening brace of a block.
        • "check-postbrace" checks for whitespace after an opening brace.
        Examples
        "whitespace": true,check-branch,check-operator,check-typecast
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "check-branch",
              "check-decl",
              "check-operator",
              "check-module",
              "check-separator",
              "check-rest-spread",
              "check-type",
              "check-typecast",
              "check-type-operator",
              "check-preblock",
              "check-postbrace"
            ]
          },
          "minLength": 0,
          "maxLength": 11
        }

        For more information see this page.

        space indentation expected
        Open

            get frames():Array<ISpriteProperties>
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: indent

        Enforces indentation with tabs or spaces.

        Rationale

        Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

        Notes
        • Has Fix

        Config

        One of the following arguments must be provided:

        • spaces enforces consistent spaces.
        • tabs enforces consistent tabs.

        A second optional argument specifies indentation size:

        • 2 enforces 2 space indentation.
        • 4 enforces 4 space indentation.

        Indentation size is required for auto-fixing, but not for rule checking.

        NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

        Examples
        "indent": true,spaces
        "indent": true,spaces,4
        "indent": true,tabs,2
        Schema
        {
          "type": "array",
          "items": [
            {
              "type": "string",
              "enum": [
                "tabs",
                "spaces"
              ]
            },
            {
              "type": "number",
              "enum": [
                2,
                4
              ]
            }
          ],
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        space indentation expected
        Open

            canvas:HTMLCanvasElement;
        Severity: Minor
        Found in src/lib/IStage.ts by tslint

        Rule: indent

        Enforces indentation with tabs or spaces.

        Rationale

        Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

        Notes
        • Has Fix

        Config

        One of the following arguments must be provided:

        • spaces enforces consistent spaces.
        • tabs enforces consistent tabs.

        A second optional argument specifies indentation size:

        • 2 enforces 2 space indentation.
        • 4 enforces 4 space indentation.

        Indentation size is required for auto-fixing, but not for rule checking.

        NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

        Examples
        "indent": true,spaces
        "indent": true,spaces,4
        "indent": true,tabs,2
        Schema
        {
          "type": "array",
          "items": [
            {
              "type": "string",
              "enum": [
                "tabs",
                "spaces"
              ]
            },
            {
              "type": "number",
              "enum": [
                2,
                4
              ]
            }
          ],
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        space indentation expected
        Open

            {
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: indent

        Enforces indentation with tabs or spaces.

        Rationale

        Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

        Notes
        • Has Fix

        Config

        One of the following arguments must be provided:

        • spaces enforces consistent spaces.
        • tabs enforces consistent tabs.

        A second optional argument specifies indentation size:

        • 2 enforces 2 space indentation.
        • 4 enforces 4 space indentation.

        Indentation size is required for auto-fixing, but not for rule checking.

        NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

        Examples
        "indent": true,spaces
        "indent": true,spaces,4
        "indent": true,tabs,2
        Schema
        {
          "type": "array",
          "items": [
            {
              "type": "string",
              "enum": [
                "tabs",
                "spaces"
              ]
            },
            {
              "type": "number",
              "enum": [
                2,
                4
              ]
            }
          ],
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        missing whitespace
        Open

            public free:boolean;
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: whitespace

        Enforces whitespace style conventions.

        Rationale

        Helps maintain a readable, consistent style in your codebase.

        Notes
        • Has Fix

        Config

        Several arguments may be optionally provided:

        • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
        • "check-decl"checks that variable declarations have whitespace around the equals token.
        • "check-operator" checks for whitespace around operator tokens.
        • "check-module" checks for whitespace in import & export statements.
        • "check-separator" checks for whitespace after separator tokens (,/;).
        • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
        • "check-type" checks for whitespace before a variable type specification.
        • "check-typecast" checks for whitespace between a typecast and its target.
        • "check-type-operator" checks for whitespace between type operators | and &.
        • "check-preblock" checks for whitespace before the opening brace of a block.
        • "check-postbrace" checks for whitespace after an opening brace.
        Examples
        "whitespace": true,check-branch,check-operator,check-typecast
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "check-branch",
              "check-decl",
              "check-operator",
              "check-module",
              "check-separator",
              "check-rest-spread",
              "check-type",
              "check-typecast",
              "check-type-operator",
              "check-preblock",
              "check-postbrace"
            ]
          },
          "minLength": 0,
          "maxLength": 11
        }

        For more information see this page.

        space indentation expected
        Open

            {
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: indent

        Enforces indentation with tabs or spaces.

        Rationale

        Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

        Notes
        • Has Fix

        Config

        One of the following arguments must be provided:

        • spaces enforces consistent spaces.
        • tabs enforces consistent tabs.

        A second optional argument specifies indentation size:

        • 2 enforces 2 space indentation.
        • 4 enforces 4 space indentation.

        Indentation size is required for auto-fixing, but not for rule checking.

        NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

        Examples
        "indent": true,spaces
        "indent": true,spaces,4
        "indent": true,tabs,2
        Schema
        {
          "type": "array",
          "items": [
            {
              "type": "string",
              "enum": [
                "tabs",
                "spaces"
              ]
            },
            {
              "type": "number",
              "enum": [
                2,
                4
              ]
            }
          ],
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        missing whitespace
        Open

            get properties():ICinematic
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: whitespace

        Enforces whitespace style conventions.

        Rationale

        Helps maintain a readable, consistent style in your codebase.

        Notes
        • Has Fix

        Config

        Several arguments may be optionally provided:

        • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
        • "check-decl"checks that variable declarations have whitespace around the equals token.
        • "check-operator" checks for whitespace around operator tokens.
        • "check-module" checks for whitespace in import & export statements.
        • "check-separator" checks for whitespace after separator tokens (,/;).
        • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
        • "check-type" checks for whitespace before a variable type specification.
        • "check-typecast" checks for whitespace between a typecast and its target.
        • "check-type-operator" checks for whitespace between type operators | and &.
        • "check-preblock" checks for whitespace before the opening brace of a block.
        • "check-postbrace" checks for whitespace after an opening brace.
        Examples
        "whitespace": true,check-branch,check-operator,check-typecast
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "check-branch",
              "check-decl",
              "check-operator",
              "check-module",
              "check-separator",
              "check-rest-spread",
              "check-type",
              "check-typecast",
              "check-type-operator",
              "check-preblock",
              "check-postbrace"
            ]
          },
          "minLength": 0,
          "maxLength": 11
        }

        For more information see this page.

        missing whitespace
        Open

            public goto(frame:number):void
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: whitespace

        Enforces whitespace style conventions.

        Rationale

        Helps maintain a readable, consistent style in your codebase.

        Notes
        • Has Fix

        Config

        Several arguments may be optionally provided:

        • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
        • "check-decl"checks that variable declarations have whitespace around the equals token.
        • "check-operator" checks for whitespace around operator tokens.
        • "check-module" checks for whitespace in import & export statements.
        • "check-separator" checks for whitespace after separator tokens (,/;).
        • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
        • "check-type" checks for whitespace before a variable type specification.
        • "check-typecast" checks for whitespace between a typecast and its target.
        • "check-type-operator" checks for whitespace between type operators | and &.
        • "check-preblock" checks for whitespace before the opening brace of a block.
        • "check-postbrace" checks for whitespace after an opening brace.
        Examples
        "whitespace": true,check-branch,check-operator,check-typecast
        Schema
        {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "check-branch",
              "check-decl",
              "check-operator",
              "check-module",
              "check-separator",
              "check-rest-spread",
              "check-type",
              "check-typecast",
              "check-type-operator",
              "check-preblock",
              "check-postbrace"
            ]
          },
          "minLength": 0,
          "maxLength": 11
        }

        For more information see this page.

        space indentation expected
        Open

            public direction:number;
        Severity: Minor
        Found in src/lib/LightCinematic.ts by tslint

        Rule: indent

        Enforces indentation with tabs or spaces.

        Rationale

        Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

        Notes
        • Has Fix

        Config

        One of the following arguments must be provided:

        • spaces enforces consistent spaces.
        • tabs enforces consistent tabs.

        A second optional argument specifies indentation size:

        • 2 enforces 2 space indentation.
        • 4 enforces 4 space indentation.

        Indentation size is required for auto-fixing, but not for rule checking.

        NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

        Examples
        "indent": true,spaces
        "indent": true,spaces,4
        "indent": true,tabs,2
        Schema
        {
          "type": "array",
          "items": [
            {
              "type": "string",
              "enum": [
                "tabs",
                "spaces"
              ]
            },
            {
              "type": "number",
              "enum": [
                2,
                4
              ]
            }
          ],
          "minLength": 0,
          "maxLength": 5
        }

        For more information see this page.

        Severity
        Category
        Status
        Source
        Language