radare/radare2-webui

View on GitHub

Showing 2,691 of 2,691 total issues

Function populateFrom has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    populateFrom(offset) {
        // From currentOffset
        // I want at least 80% of 3 screens

        // go up of 1 screen, take first in order
Severity: Minor
Found in www/m/js/modules/disasm/DisassemblyNavigator.js - About 2 hrs 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 render has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

BBGraph.prototype.render = function() {
    var name = Object.keys(this.vertices).toString();
    var outergbox = document.createElement('div');
    outergbox.id = 'outergbox';
    var bbcanvas = document.getElementById('canvas');
Severity: Minor
Found in www/lib/disasm.js - About 2 hrs 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 drawChunk has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    drawChunk(chunk, where) {
        if (chunk.offset === 0 && chunk.hex.length === 0) {
            return this.firstElement;
        }

Severity: Major
Found in www/m/js/modules/hexdump/Hexdump.js - About 2 hrs to fix

    Function do_rename has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function do_rename(element, inEvent) {
        var address = get_address_from_class(element);
        if ($(element).hasClass('addr') && $(element).hasClass('flag')) {
            var space = '*';
            if ($(element).hasClass('function')) space = 'functions';
    Severity: Major
    Found in www/p/lib/js/panels/disasm_panel.js - About 2 hrs to fix

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

      r2.get_disasm_before = function(offset, start, cb) {
          var before = [];
          r2.cmd('pdj -' + start + '@' + offset + '|', function(x) {
              before = JSON.parse(x);
          });
      Severity: Major
      Found in www/lib/r2.js and 1 other location - About 2 hrs to fix
      www/lib/r2.js on lines 229..235

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

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

          getPanel() {
              var c = document.createElement('div');
      
              var header = document.createElement('div');
              header.style.position = 'fixed';
      Severity: Major
      Found in www/m/js/widgets/FunctionsWidget.js - About 2 hrs to fix

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

        r2.get_disasm_after = function(offset, end, cb) {
            var after = [];
            r2.cmd('pdj ' + end + '@' + offset + '|', function(x) {
                after = JSON.parse(x);
            });
        Severity: Major
        Found in www/lib/r2.js and 1 other location - About 2 hrs to fix
        www/lib/r2.js on lines 221..227

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

        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 has a complexity of 12.
        Open

                return function(node, next_node) {

        Limit Cyclomatic Complexity (complexity)

        Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

        function a(x) {
            if (true) {
                return x; // 1st path
            } else if (false) {
                return x+1; // 2nd path
            } else {
                return 4; // 3rd path
            }
        }

        Rule Details

        This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

        Examples of incorrect code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else if (false) {
                return x+1;
            } else {
                return 4; // 3rd path
            }
        }

        Examples of correct code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else {
                return 4;
            }
        }

        Options

        Optionally, you may specify a max object property:

        "complexity": ["error", 2]

        is equivalent to

        "complexity": ["error", { "max": 2 }]

        Deprecated: the object property maximum is deprecated. Please use the property max instead.

        When Not To Use It

        If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

        Further Reading

        Related Rules

        • [max-depth](max-depth.md)
        • [max-len](max-len.md)
        • [max-nested-callbacks](max-nested-callbacks.md)
        • [max-params](max-params.md)
        • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

        Function 'do_rename' has a complexity of 12.
        Open

        function do_rename(element, inEvent) {
        Severity: Minor
        Found in www/p/lib/js/panels/disasm_panel.js by eslint

        Limit Cyclomatic Complexity (complexity)

        Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

        function a(x) {
            if (true) {
                return x; // 1st path
            } else if (false) {
                return x+1; // 2nd path
            } else {
                return 4; // 3rd path
            }
        }

        Rule Details

        This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

        Examples of incorrect code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else if (false) {
                return x+1;
            } else {
                return 4; // 3rd path
            }
        }

        Examples of correct code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else {
                return 4;
            }
        }

        Options

        Optionally, you may specify a max object property:

        "complexity": ["error", 2]

        is equivalent to

        "complexity": ["error", { "max": 2 }]

        Deprecated: the object property maximum is deprecated. Please use the property max instead.

        When Not To Use It

        If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

        Further Reading

        Related Rules

        • [max-depth](max-depth.md)
        • [max-len](max-len.md)
        • [max-nested-callbacks](max-nested-callbacks.md)
        • [max-params](max-params.md)
        • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

        Function 'Ajax' has a complexity of 12.
        Open

        function Ajax(method, uri, body, fn, err) {
        Severity: Minor
        Found in www/lib/r2.js by eslint

        Limit Cyclomatic Complexity (complexity)

        Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

        function a(x) {
            if (true) {
                return x; // 1st path
            } else if (false) {
                return x+1; // 2nd path
            } else {
                return 4; // 3rd path
            }
        }

        Rule Details

        This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

        Examples of incorrect code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else if (false) {
                return x+1;
            } else {
                return 4; // 3rd path
            }
        }

        Examples of correct code for a maximum of 2:

        /*eslint complexity: ["error", 2]*/
        
        function a(x) {
            if (true) {
                return x;
            } else {
                return 4;
            }
        }

        Options

        Optionally, you may specify a max object property:

        "complexity": ["error", 2]

        is equivalent to

        "complexity": ["error", { "max": 2 }]

        Deprecated: the object property maximum is deprecated. Please use the property max instead.

        When Not To Use It

        If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

        Further Reading

        Related Rules

        • [max-depth](max-depth.md)
        • [max-len](max-len.md)
        • [max-nested-callbacks](max-nested-callbacks.md)
        • [max-params](max-params.md)
        • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

        Function _selectNode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            JqTreeWidget.prototype._selectNode = function(node, must_toggle) {
              var canSelect, deselected_node, openParents, saveState;
              if (must_toggle == null) {
                must_toggle = false;
              }
        Severity: Major
        Found in www/p/lib/js/dependencies/tree.jquery.js - About 2 hrs to fix

          Function Ajax has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Ajax(method, uri, body, fn, err) {
              if (typeof (XMLHttpRequest) == 'undefined') {
                  return false;
              }
              if (r2.asyncMode == 'fake') {
          Severity: Major
          Found in www/lib/r2.js - About 2 hrs to fix

            Function handleClick has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function handleClick(inEvent) {
            
                if ($(inEvent.target).hasClass('addr')) {
                    if ($(inEvent.target).hasClass('history')) {
                        var idx = inEvent.target.className.split(' ').filter(function(x) { return x.substr(0, 'history_idx_'.length) == 'history_idx_'; });
            Severity: Major
            Found in www/p/lib/js/panels/disasm_panel.js - About 2 hrs to fix

              Function getPanel has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  getPanel() {
                      var c = document.createElement('div');
                      if (this.inColor) {
                          c.style.backgroundColor = '#202020';
                      }
              Severity: Major
              Found in www/m/js/widgets/FlagsSpacesWidget.js - About 2 hrs to fix

                Function instanciate_ has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    instanciate_(widget) {
                        switch (widget) {
                        case Widgets.OVERVIEW:
                            this.widgets[widget] = new OverviewWidget();
                            break;
                Severity: Major
                Found in www/m/js/widgets/WidgetFactory.js - About 2 hrs to fix

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

                                  r2.cmd('axt @' + address, function(x) {
                                      var lines = x.split('\n');
                                      for (var l in lines) {
                                          if (lines[l] !== '') xrefs_from[xrefs_from.length] = lines[l];
                                      }
                  Severity: Major
                  Found in www/p/lib/js/panels/disasm_panel.js and 1 other location - About 2 hrs to fix
                  www/p/lib/js/panels/disasm_panel.js on lines 56..61

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

                  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

                                  r2.cmd('axf @' + address, function(x) {
                                      var lines = x.split('\n');
                                      for (var l in lines) {
                                          if (lines[l] !== '') xrefs_to[xrefs_to.length] = lines[l];
                                      }
                  Severity: Major
                  Found in www/p/lib/js/panels/disasm_panel.js and 1 other location - About 2 hrs to fix
                  www/p/lib/js/panels/disasm_panel.js on lines 72..77

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

                  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

                      setFlagspace() {
                          let fs = this.current;
                          if (!fs) {
                              fs = prompt('name');
                          }
                  Severity: Major
                  Found in www/m/js/widgets/FlagsSpacesWidget.js and 1 other location - About 2 hrs to fix
                  www/m/js/widgets/FlagsSpacesWidget.js on lines 115..126

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

                  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

                      renameFlagspace() {
                          let fs = this.current;
                          if (!fs) {
                              fs = prompt('name');
                          }
                  Severity: Major
                  Found in www/m/js/widgets/FlagsSpacesWidget.js and 1 other location - About 2 hrs to fix
                  www/m/js/widgets/FlagsSpacesWidget.js on lines 102..113

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

                  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 'on_scroll' has a complexity of 11.
                  Open

                  function on_scroll(event) {
                  Severity: Minor
                  Found in www/lib/disasm.js by eslint

                  Limit Cyclomatic Complexity (complexity)

                  Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

                  function a(x) {
                      if (true) {
                          return x; // 1st path
                      } else if (false) {
                          return x+1; // 2nd path
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Rule Details

                  This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

                  Examples of incorrect code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else if (false) {
                          return x+1;
                      } else {
                          return 4; // 3rd path
                      }
                  }

                  Examples of correct code for a maximum of 2:

                  /*eslint complexity: ["error", 2]*/
                  
                  function a(x) {
                      if (true) {
                          return x;
                      } else {
                          return 4;
                      }
                  }

                  Options

                  Optionally, you may specify a max object property:

                  "complexity": ["error", 2]

                  is equivalent to

                  "complexity": ["error", { "max": 2 }]

                  Deprecated: the object property maximum is deprecated. Please use the property max instead.

                  When Not To Use It

                  If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

                  Further Reading

                  Related Rules

                  • [max-depth](max-depth.md)
                  • [max-len](max-len.md)
                  • [max-nested-callbacks](max-nested-callbacks.md)
                  • [max-params](max-params.md)
                  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/
                  Severity
                  Category
                  Status
                  Source
                  Language