radare/radare2-webui

View on GitHub

Showing 2,705 of 2,705 total issues

Function handleKeyPress has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handleKeyPress: function(inSender, inEvent) {
        var keynum = inEvent.keyCode || inEvent.charCode || inEvent.which || 0;
        var key = String.fromCharCode(keynum);
        // console.log(key);

Severity: Major
Found in www/enyo/js/disassembler.js - About 4 hrs to fix

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

                    for (var j = 0 ; j < items[i].expand.length ; j++) {
                        var subLi = document.createElement('li');
                        subUl.appendChild(subLi);
                        subLi.appendChild(document.createTextNode(items[i].expand[j].name));
                        bindAction(subLi, items[i].expand[j].fct);
    Severity: Major
    Found in www/m/js/modules/disasm/Disassembly.js and 1 other location - About 4 hrs to fix
    www/m/js/modules/hexdump/Hexdump.js on lines 888..893

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

    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

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

                    for (var j = 0 ; j < items[i].expand.length ; j++) {
                        var subLi = document.createElement('li');
                        subUl.appendChild(subLi);
                        subLi.appendChild(document.createTextNode(items[i].expand[j].name));
                        bindAction(subLi, items[i].expand[j].fct);
    Severity: Major
    Found in www/m/js/modules/hexdump/Hexdump.js and 1 other location - About 4 hrs to fix
    www/m/js/modules/disasm/Disassembly.js on lines 736..741

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

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

    function render_graph(x) {
        var obj;
        try {
            obj = JSON.parse(x.replace(/\\l/g, '\\n'));
        } catch (e) {
    Severity: Minor
    Found in www/lib/disasm.js - About 4 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 104 lines of code (exceeds 25 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: Major
    Found in www/lib/disasm.js - About 4 hrs to fix

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

      function highlight_dword(inEvent) {
          if ($(inEvent.target).hasClass('dword')) {
              var dword = inEvent.target.className.split(' ').filter(function(x) { return x.substr(0, 'dword_'.length) == 'dword_'; });
              $('.autohighlighti').removeClass('autohighlighti');
              $('.' + dword).addClass('autohighlighti');
      Severity: Major
      Found in www/p/lib/js/panels/hex_panel.js and 1 other location - About 4 hrs to fix
      www/p/lib/js/panels/hex_panel.js on lines 117..123

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

      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

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

              $('.dword').click(function(inEvent) {
                  if ($(inEvent.target).hasClass('dword')) {
                      var dword = inEvent.target.className.split(' ').filter(function(x) { return x.substr(0, 'dword_'.length) == 'dword_'; });
                      $('.autohighlighti').removeClass('autohighlighti');
                      $('.' + dword).addClass('autohighlighti');
      Severity: Major
      Found in www/p/lib/js/panels/hex_panel.js and 1 other location - About 4 hrs to fix
      www/p/lib/js/panels/hex_panel.js on lines 362..368

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

      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 'render_instructions' has a complexity of 27.
      Open

      function render_instructions(instructions) {
      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/

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

          t.new_frame(n, newthing(n), function (obj) {
            var flags = _(n + '_console');
            if (flags) {
              var top = flags.style.offsetTop;
              var pos = findPos(flags);
      Severity: Major
      Found in www/t/js/main.js and 5 other locations - About 4 hrs to fix
      www/t/js/main.js on lines 136..144
      www/t/js/main.js on lines 233..241
      www/t/js/main.js on lines 260..268
      www/t/js/main.js on lines 273..281
      www/t/js/main.js on lines 352..360

      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 6 locations. Consider refactoring.
      Open

          t.new_frame(n, newthing(n), function (obj) {
            var flags = _(n + '_flags');
            if (flags) {
              var top = flags.style.offsetTop;
              var pos = findPos(flags);
      Severity: Major
      Found in www/t/js/main.js and 5 other locations - About 4 hrs to fix
      www/t/js/main.js on lines 136..144
      www/t/js/main.js on lines 154..162
      www/t/js/main.js on lines 233..241
      www/t/js/main.js on lines 273..281
      www/t/js/main.js on lines 352..360

      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 6 locations. Consider refactoring.
      Open

          t.new_frame(n, msgbody, function (obj) {
            var code = _(n + 'code');
            if (code) {
              var top = code.style.offsetTop;
              var pos = findPos(code);
      Severity: Major
      Found in www/t/js/main.js and 5 other locations - About 4 hrs to fix
      www/t/js/main.js on lines 136..144
      www/t/js/main.js on lines 154..162
      www/t/js/main.js on lines 233..241
      www/t/js/main.js on lines 260..268
      www/t/js/main.js on lines 352..360

      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 6 locations. Consider refactoring.
      Open

          t.new_frame(n, newthing(n), function (obj) {
            var flags = _(n + '_help');
            if (flags) {
              var top = flags.style.offsetTop;
              var pos = findPos(flags);
      Severity: Major
      Found in www/t/js/main.js and 5 other locations - About 4 hrs to fix
      www/t/js/main.js on lines 154..162
      www/t/js/main.js on lines 233..241
      www/t/js/main.js on lines 260..268
      www/t/js/main.js on lines 273..281
      www/t/js/main.js on lines 352..360

      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 6 locations. Consider refactoring.
      Open

          t.new_frame(n, newthing(n), function (obj) {
            var flags = _(n + '_frame');
            if (flags) {
              var top = flags.style.offsetTop;
              var pos = findPos(flags);
      Severity: Major
      Found in www/t/js/main.js and 5 other locations - About 4 hrs to fix
      www/t/js/main.js on lines 136..144
      www/t/js/main.js on lines 154..162
      www/t/js/main.js on lines 260..268
      www/t/js/main.js on lines 273..281
      www/t/js/main.js on lines 352..360

      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 6 locations. Consider refactoring.
      Open

          t.new_frame(n, disasmbody, function (obj) {
            var code = _(n + '_notes');
            if (code) {
              var top = code.style.offsetTop;
              var pos = findPos(code);
      Severity: Major
      Found in www/t/js/main.js and 5 other locations - About 4 hrs to fix
      www/t/js/main.js on lines 136..144
      www/t/js/main.js on lines 154..162
      www/t/js/main.js on lines 233..241
      www/t/js/main.js on lines 260..268
      www/t/js/main.js on lines 273..281

      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

      Function has a complexity of 25.
      Open

        document.onkeydown = function (evt) {
      Severity: Minor
      Found in www/t/js/main.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 tile has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.tile = function () {
          if (this.modal) {
            var mtop = topmargin;
            var left = 0;
            var width = w - (w / 20);
      Severity: Major
      Found in www/t/js/tiled.js - About 3 hrs to fix

        Function highlight_instruction has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        function highlight_instruction(line, instruction) {
            if (line === undefined) return 'undefined';
            if (instruction === undefined) instruction = true;
            var ret = escapeHTML(line);
        
        
        Severity: Minor
        Found in www/lib/disasm.js - About 3 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 Ajax has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        function Ajax(method, uri, body, fn, err) {
            if (typeof (XMLHttpRequest) == 'undefined') {
                return false;
            }
            if (r2.asyncMode == 'fake') {
        Severity: Minor
        Found in www/lib/r2.js - About 3 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

        File main.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var myLayout;
        
        $(document).ready(function() {
        
            r2.cmd('e scr.html=false');
        Severity: Minor
        Found in www/p/lib/js/main.js - About 3 hrs to fix

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

                  for (var i in cells) {
                      if (cells[i].className !== undefined) {
                          var dword = cells[i].className.split(' ').filter(function(x) { return x.substr(0, 'dword_'.length) == 'dword_'; });
                          $('.' + dword).addClass('autohighlighti');
                      }
          Severity: Major
          Found in www/p/lib/js/panels/hex_panel.js and 1 other location - About 3 hrs to fix
          www/p/lib/js/panels/hex_panel.js on lines 238..243

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

          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

          Severity
          Category
          Status
          Source
          Language