Samisdat/ts-conway

View on GitHub

Showing 21 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

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

              public setEnd(end: Position): void {
                  this.x.setEnd(end.x);
                  this.y.setEnd(end.y);
              }
          Severity: Major
          Found in typescript/Tween/Tweenposition.ts and 1 other location - About 1 hr to fix
          typescript/Tween/Tweenposition.ts on lines 28..31

          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 57.

          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

              public overwrite(overwrite: Position): void {
                  this.x.overwrite(overwrite.x);
                  this.y.overwrite(overwrite.y);
              }
          Severity: Major
          Found in typescript/Tween/Tweenposition.ts and 1 other location - About 1 hr to fix
          typescript/Tween/Tweenposition.ts on lines 23..26

          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 57.

          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

          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

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

                    const creator = new Creator(
                        this.element.offsetWidth,
                        this.element.offsetHeight,
                        CELL_WIDTH,
                        this.control.getPan(),
            Severity: Minor
            Found in typescript/Frontend/Web.ts and 1 other location - About 55 mins to fix
            typescript/Frontend/Web.ts on lines 69..75

            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 53.

            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

                    const gridCreator = new Creator(
                        this.element.offsetWidth,
                        this.element.offsetHeight,
                        CELL_WIDTH,
                        this.control.getPan(),
            Severity: Minor
            Found in typescript/Frontend/Web.ts and 1 other location - About 55 mins to fix
            typescript/Frontend/Web.ts on lines 85..91

            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 53.

            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

            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

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

                public getWidth(): number{
            
                    return this.x.getMax() - this.x.getMin() + 1;
            
                }
            Severity: Minor
            Found in typescript/Geometry/Boundposition.ts and 1 other location - About 30 mins to fix
            typescript/Geometry/Boundposition.ts on lines 55..59

            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 45.

            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

                public getHeight(): number{
            
                    return this.y.getMax() - this.y.getMin() + 1;
            
                }
            Severity: Minor
            Found in typescript/Geometry/Boundposition.ts and 1 other location - About 30 mins to fix
            typescript/Geometry/Boundposition.ts on lines 49..53

            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 45.

            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

            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