karyfoundation/graph

View on GitHub

Showing 37 of 37 total issues

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

        function AddLineCommentCommand ( editor: monaco.editor.IStandaloneCodeEditor ) {
            editor.addAction({
                id: 'kary-comment-insert-line-comment',
                label: 'Insert Line Comment',
                keybindings: [ monaco.KeyMod.Alt | monaco.KeyCode.KEY_L ],
Severity: Major
Found in core/karyfoundation/monaco/kf-comment-monaco.ts and 1 other location - About 4 hrs to fix
core/karyfoundation/monaco/kf-comment-monaco.ts on lines 29..44

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

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

        function AddSectionCommentCommand ( editor: monaco.editor.IStandaloneCodeEditor ) {
            editor.addAction({
                id: 'kary-comment-insert-section-comment',
                label: 'Insert Section Comment',
                keybindings: [ monaco.KeyMod.Alt | monaco.KeyCode.KEY_Y ],
Severity: Major
Found in core/karyfoundation/monaco/kf-comment-monaco.ts and 1 other location - About 4 hrs to fix
core/karyfoundation/monaco/kf-comment-monaco.ts on lines 50..65

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

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

    function neighbors ( a: KaryGraph.API.AbstractionLayer.DotObjectOrDotID,
                         b: KaryGraph.API.AbstractionLayer.DotObjectOrDotID ): boolean {
        let d1 = KaryGraph.API.AbstractionLayer.GetDotByDotOrId( a );
        let d2 = KaryGraph.API.AbstractionLayer.GetDotByDotOrId( b );
        return d1.IsConnectedTo( d2 );
Severity: Major
Found in core/api/api.ts and 1 other location - About 4 hrs to fix
core/api/api.ts on lines 168..173

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

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

    function disconnect ( a: KaryGraph.API.AbstractionLayer.DotObjectOrDotID, 
                          b: KaryGraph.API.AbstractionLayer.DotObjectOrDotID ): boolean {
        let d1 = KaryGraph.API.AbstractionLayer.GetDotByDotOrId( a );
        let d2 = KaryGraph.API.AbstractionLayer.GetDotByDotOrId( b );
        return d1.DisconnectFrom( d2 );
Severity: Major
Found in core/api/api.ts and 1 other location - About 4 hrs to fix
core/api/api.ts on lines 395..400

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

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

Dot has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

        export class Dot {

            //
            // ─── GLOBALS ─────────────────────────────────────────────────────
            //
Severity: Minor
Found in core/objects/dot/dot.ts - About 2 hrs to fix

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

                        if ( Storage.Nodes[ dotID ] != undefined
                             && Storage.Nodes[ dotID ].Inputs[ this.Id ] != undefined ) {
                            delete Storage.Nodes[ dotID ].Inputs[ this.Id ];
                        }
    Severity: Major
    Found in core/objects/dot/dot.ts and 1 other location - About 1 hr to fix
    core/objects/dot/dot.ts on lines 188..191

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

    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

                        if ( Storage.Nodes[ dotID ] != undefined
                             && Storage.Nodes[ dotID ].Outputs[ this.Id ] != undefined ) {
                            delete Storage.Nodes[ dotID ].Outputs[ this.Id ];
                        }
    Severity: Major
    Found in core/objects/dot/dot.ts and 1 other location - About 1 hr to fix
    core/objects/dot/dot.ts on lines 208..211

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

    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 a Cognitive Complexity of 14 (exceeds 5 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

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

            export function Tree ( ): boolean {
    
                // vars
                var map = new Map( );
                var keys = Object.keys( Storage.Nodes );
    Severity: Minor
    Found in core/api/stdlib/sortings.ts - About 1 hr to fix

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

              export function DragModeFunctionEditMode( circle: ISnapObject, dx: number,
                                                        dy: number, posx: number, posy: number ) {
      
                  ScriptEngine.EventHandler.RunEvents( 'OnMove', circle.id );
              }
      Severity: Major
      Found in core/objects/dot/drag-move.ts and 1 other location - About 1 hr to fix
      core/objects/dot/drag-move.ts on lines 36..40

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

      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 DragModeFunctionRemoveMode( circle: ISnapObject, dx: number,
                                                          dy: number, posx: number, posy: number ) {
      
                  ScriptEngine.EventHandler.RunEvents( 'OnRemove', circle.id );
              }
      Severity: Major
      Found in core/objects/dot/drag-move.ts and 1 other location - About 1 hr to fix
      core/objects/dot/drag-move.ts on lines 46..50

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

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

              export function Tree ( ): boolean {
      
                  // vars
                  var map = new Map( );
                  var keys = Object.keys( Storage.Nodes );
      Severity: Minor
      Found in core/api/stdlib/sortings.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 RenderSpiral has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              export function RenderSpiral ( ) {
      
                  //
                  // ─── ENUMS ───────────────────────────────────────────────────────
                  //
      Severity: Minor
      Found in core/rendering/spiral.ts - About 1 hr to fix

        Function GenerateSomeRandomNodes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                export function GenerateSomeRandomNodes ( howManyNodes: number ) {
                    // defs
                    const baseUnit = 120;
                    const widthUnit = Math.floor( GraphWidth / baseUnit );
                    const heightUnit = Math.floor( GraphHeight / baseUnit );
        Severity: Minor
        Found in core/editor/graph.ts - About 1 hr to fix

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

                          public MoveStart ( position: Point ) {
                              this.SnapCircle.attr({
                                  x1: position.X, y1: 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 66..70

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

          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 MoveStart ( position: Point ) {
                              this.SnapLine.attr({
                                  x1: position.X, y1: 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 64..68

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

          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

                          case TabOptions.Editor:
                              tabContainer.className = 'editor-tab';
          
                              editorTabView.hidden = false;
                              programmerTabView.hidden = true;
          Severity: Major
          Found in core/ui/tabs.ts and 1 other location - About 1 hr to fix
          core/ui/tabs.ts on lines 56..62

          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

                          case TabOptions.Programmer:
                              tabContainer.className = 'programmer-tab';
          
                              editorTabView.hidden = true;
                              programmerTabView.hidden = false;
          Severity: Major
          Found in core/ui/tabs.ts and 1 other location - About 1 hr to fix
          core/ui/tabs.ts on lines 46..52

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

              function graphfrommatrix ( matrix: number[][] ) {
                  var numberOfNodes = matrix.length;
                  for ( var i = 0; i < numberOfNodes; i++ ) {
                      if ( matrix[ i ].length != numberOfNodes ) {
                          // KaryGraph.UI.Console.PrintError( "Invalid matrix." );
          Severity: Minor
          Found in core/api/api.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 GraphInitMonacoOnStart has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function GraphInitMonacoOnStart ( ) {
          
                  function uriFromPath ( _path ) {
                      var pathName = path.resolve( _path ).replace( /\\/g, '/' );
                      if ( pathName.length > 0 && pathName.charAt( 0 ) !== '/' ) {
          Severity: Minor
          Found in javascript/graph-monaco.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language