karyfoundation/graph

View on GitHub

Showing 37 of 37 total issues

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

                public MoveEnd ( position: Point ) {
                    this.SnapCircle.attr({
                        x2: position.X, y2: position.Y
                    });
                }
Severity: Major
Found in core/objects/vertex/arrow/loop.ts and 1 other location - About 1 hr to fix
core/objects/vertex/arrow/line.ts on lines 77..81

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

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 MoveEnd ( position: Point ) {
                    this.SnapLine.attr({
                        x2: position.X, y2: position.Y
                    });
                }
Severity: Major
Found in core/objects/vertex/arrow/line.ts and 1 other location - About 1 hr to fix
core/objects/vertex/arrow/loop.ts on lines 75..79

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

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 BFS has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        export function BFS ( start: Dot, steps: number ) {
            let bfs = new Array<Array<Dot>>( );
            let checked = new Array<Boolean>( );

            for ( let it = 0; it < KaryGraph.Dot.TotalDots; it++ ) {
Severity: Minor
Found in core/api/stdlib/algorithms.ts - About 1 hr to fix

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

            function OnPromptArrowsClicked ( ev: KeyboardEvent ) {
                // if ( !ev.metaKey ) return;
                let key = ev.which || ev.keyCode;
                if ( key === 38 ) {
                    /** Up Arrow Key */
    Severity: Minor
    Found in core/ui/editor-tab/notebook/programmer.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 Generate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            export function Generate ( style: Style,
                           languageCharacter: string,
                                     tabSize: number,
                                insertSpaces: boolean,
                                       text?: string,
    Severity: Minor
    Found in core/karyfoundation/comment/core.ts - About 45 mins to fix

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

                      public RemoveInputConnection ( ) {
                          this.Inputs.forEach( dotKey => {
                              this.DisconnectInput( dotKey );
                          });
                      }
      Severity: Minor
      Found in core/objects/dot/dot.ts and 1 other location - About 45 mins to fix
      core/objects/dot/dot.ts on lines 155..159

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

      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 RemoveOutputConnection ( ) {
                          this.Outputs.forEach( dotKey => {
                              this.DisconnectOutput( dotKey );
                          });
                      }
      Severity: Minor
      Found in core/objects/dot/dot.ts and 1 other location - About 45 mins to fix
      core/objects/dot/dot.ts on lines 144..148

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

      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 DragModeFunctionEditMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              export function DragModeFunctionEditMode( circle: ISnapObject, dx: number,
                                                        dy: number, posx: number, posy: number ) {
      Severity: Minor
      Found in core/objects/dot/drag-move.ts - About 35 mins to fix

        Function DragModeFunctionMoveMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                export function DragModeFunctionMoveMode( circle: ISnapObject, dx: number,
                                                          dy: number, posx: number, posy: number ) {
        Severity: Minor
        Found in core/objects/dot/drag-move.ts - About 35 mins to fix

          Function DragModeFunctionRemoveMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  export function DragModeFunctionRemoveMode( circle: ISnapObject, dx: number,
                                                              dy: number, posx: number, posy: number ) {
          Severity: Minor
          Found in core/objects/dot/drag-move.ts - About 35 mins to fix

            Function DragModeFunctionSelectMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    export function DragModeFunctionSelectMode( circle: ISnapObject, dx: number,
                                                                dy: number, posx: number, posy: number ) {
            Severity: Minor
            Found in core/objects/dot/drag-move.ts - About 35 mins to fix

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

                      export function OnAddEndingCommentButtonClicked ( ) {
                          KaryFoundation.Monaco.ExecuteAddComment( Editor, KaryFoundation.Comment.Style.Ending );
                          Editor.focus( );
                      }
              Severity: Minor
              Found in core/ui/programmer-tab/view.ts and 1 other location - About 35 mins to fix
              core/ui/programmer-tab/view.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 47.

              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

                      export function OnAddSectionCommentButtonClicked ( ) {
                          KaryFoundation.Monaco.ExecuteAddComment( Editor, KaryFoundation.Comment.Style.Section );
                          Editor.focus( );
                      }
              Severity: Minor
              Found in core/ui/programmer-tab/view.ts and 1 other location - About 35 mins to fix
              core/ui/programmer-tab/view.ts on lines 33..36

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

              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 Remove ( ) {
                                  this.SnapCircle.remove( );
                                  this.SnapArrowEnding.remove( );
                              }
              Severity: Minor
              Found in core/objects/vertex/arrow/loop.ts and 1 other location - About 30 mins to fix
              core/objects/vertex/arrow/line.ts on lines 56..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 Remove ( ) {
                                  this.SnapLine.remove( );
                                  this.SnapArrowEnding.remove( );
                              }
              Severity: Minor
              Found in core/objects/vertex/arrow/line.ts and 1 other location - About 30 mins to fix
              core/objects/vertex/arrow/loop.ts on lines 54..57

              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 GenerateSayHTML has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      export function GenerateSayHTML ( input: any ): string {
              
                          // if were going to have an undefined type.
                          if ( input == undefined ) {
                              return SayImplementations.SayUndefined( );
              Severity: Minor
              Found in core/ui/editor-tab/notebook/say.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 size has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  function size ( dots?: Array<KaryGraph.API.AbstractionLayer.DotObjectOrDotID> ): number {
                      var size: number = 0;
                      if ( dots === undefined ) {
                          for ( var i = 0; i < KaryGraph.Dot.TotalDots; i++ ) {
                              size += getdot(i + 1).NumberOfInputs();
              Severity: Minor
              Found in core/api/api.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