BabylonJS/Spector.js

View on GitHub

Showing 266 of 572 total issues

Function isValidChangeCommand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected isValidChangeCommand(command: ICommandCapture, stateName: string): boolean {
        if (command.name === "enable" || command.name === "disable") {
            return command.commandArguments[0] === WebGlConstants.STENCIL_TEST.value;
        }
        if (command.name === "stencilOp" || command.name === "stencilOpSeparate") {
Severity: Minor
Found in src/backend/states/context/stencilState.ts - About 25 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 stringifyArgs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected stringifyArgs(args: IArguments): string[] {
        const stringified = [];
        for (let i = 0; i < args.length; i++) {
            const arg = args[i];

Severity: Minor
Found in src/backend/commands/bufferSubData.ts - About 25 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 isValidChangeCommand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected isValidChangeCommand(command: ICommandCapture, stateName: string): boolean {
        if (command.name === "enable" || command.name === "disable") {
            if (command.commandArguments[0] === WebGlConstants.SAMPLE_COVERAGE.value) {
                return stateName === WebGlConstants.SAMPLE_COVERAGE.name;
            }
Severity: Minor
Found in src/backend/states/context/coverageState.ts - About 25 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 getCommandNameToStates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private getCommandNameToStates(): { [key: string]: string[] } {
        const result: { [key: string]: string[] } = {};
        for (const stateName in this.changeCommandsByState) {
            if (this.changeCommandsByState.hasOwnProperty(stateName)) {
                for (const changeCommand of this.changeCommandsByState[stateName]) {
Severity: Minor
Found in src/backend/states/baseState.ts - About 25 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 getUboValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public getUboValue(bindingPoint: number, offset: number, size: number, type: number): any {
        const uboType = DrawCallUboInputState.uboTypes[type];
        if (!uboType) {
            return undefined;
        }
Severity: Minor
Found in src/backend/states/drawCalls/drawCallUboInputState.ts - About 25 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 merge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function merge<T, U>(first: T, second: U): T & U {
    const result: any = {};
    for (const id in first) {
        if (first.hasOwnProperty(id)) {
            result[id] = first[id];
Severity: Minor
Found in src/shared/utils/merge.ts - About 25 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

Severity
Category
Status
Source
Language