Samisdat/ts-conway

View on GitHub

Showing 14 of 21 total issues

Function applyRules has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private applyRules(): void {

        const nextGeneration = new Matrix();

        /**
Severity: Minor
Found in typescript/Population.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 addEventListener has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private addEventListener(): void {

        const listen = (event: Event) => {

            let target = event.target as HTMLElement;
Severity: Minor
Found in typescript/Frontend/Control/ControlPan.ts - About 1 hr to fix

    Function gunsAndEaters has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const gunsAndEaters: SeedFunction = (gridCreator: Creator, matrix: Matrix) => {
    
        const gunsAndEaters = readPatternFromPlainFile(gunsAndEatersPattern);
    
        const patternGutter = 2;
    Severity: Minor
    Found in typescript/Pattern/Seed/guns_and_eaters.ts - About 1 hr to fix

      Function matrixToString has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const matrixToString = (matrix: Matrix, scale = true): string => {
      
          if(0 === matrix.getAll().length){
              return 'Matrix is empty';
          }
      Severity: Minor
      Found in typescript/Geometry/matrixToString.ts - About 1 hr to fix

        Function extractePattern has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const extractePattern = (patternPlainText: string): ExtractedPattern => {
        
            const extractedPattern: ExtractedPattern = {
                name: 'unnamed',
                pattern: []
        Severity: Minor
        Found in typescript/Pattern/readPatternFromPlainFile.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 createGridCells has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private createGridCells(relativePointer: Position, absolutePointer: Position){
        
                const moveRight = new Position(
                    1,
                    0
        Severity: Minor
        Found in typescript/Habitat.ts - About 1 hr to fix

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

              public getNeighbours(): Position[] {
          
                  const neighbours: Position[] = [];
          
                  // neighbours on bottom
          Severity: Minor
          Found in typescript/Geometry/Position.ts - About 1 hr to fix

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

            export const matrixToString = (matrix: Matrix, scale = true): string => {
            
                if(0 === matrix.getAll().length){
                    return 'Matrix is empty';
                }
            Severity: Minor
            Found in typescript/Geometry/matrixToString.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 rotate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public rotate(): void {
            
                    const matrix = this.toArray();
            
                    const rotated: number[][] = [];
            Severity: Minor
            Found in typescript/Pattern/Pattern.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 toArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public toArray(): number[][] {
            
                    const moved = new Matrix();
            
                    const moveBy = this.getMatrix().getBound().bottomLeft().inverse();
            Severity: Minor
            Found in typescript/Pattern/Pattern.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 getSigns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const getSigns = (numberedScale: NumberedScale, i: number) =>{
                if(0 === i % 5){
            
                    numberedScale.number.push(Math.abs(i).toString());
            
            
            Severity: Minor
            Found in typescript/Geometry/matrixToString.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 setCheckerboardColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private setCheckerboardColor(): void {
            
                    const x = this.absolutePosition.x;
                    const y = this.absolutePosition.y;
            
            
            Severity: Minor
            Found in typescript/Habitat/Cell.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 createGridCells has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private createGridCells(relativePointer: Position, absolutePointer: Position){
            
                    const moveRight = new Position(
                        1,
                        0
            Severity: Minor
            Found in typescript/Habitat.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 readPatternFromPlainFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const readPatternFromPlainFile = (patternPlainText: string): Pattern => {
            
                const extractedPattern = extractePattern(patternPlainText);
            
                const matrix = new Matrix();
            Severity: Minor
            Found in typescript/Pattern/readPatternFromPlainFile.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