radare/radare2-webui

View on GitHub

Showing 2,691 of 2,691 total issues

File tree.jquery.js has 2649 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Generated by CoffeeScript 1.7.1
(function() {
  var $, BorderDropHint, DragAndDropHandler, DragElement, ElementsRenderer, FolderElement, GhostDropHint, HitAreasGenerator, JqTreeWidget, KeyHandler, MouseWidget, Node, NodeElement, Position, SaveStateHandler, ScrollHandler, SelectNodeHandler, SimpleWidget, VisibleNodeIterator, get_json_stringify_function, html_escape, indexOf, isInt, __version__, _indexOf,
    __slice = [].slice,
    __hasProp = {}.hasOwnProperty,
Severity: Major
Found in www/p/lib/js/dependencies/tree.jquery.js - About 1 wk to fix

    Function Tiled has a Cognitive Complexity of 251 (exceeds 5 allowed). Consider refactoring.
    Open

    function Tiled (id) {
      var obj = document.getElementById(id);
      var self = this;
      this.modal = null;
      this.curframe = undefined;
    Severity: Minor
    Found in www/t/js/tiled.js - About 5 days 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 onload has 508 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window.onload = function () {
      var position = 'right';
      var t = new Tiled('canvas');
      var ctr = 0;
      r2.cmd('e scr.color=3;eco sepia;e scr.html=true', function () {
    Severity: Major
    Found in www/t/js/main.js - About 2 days to fix

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

              if ($(this.selected).hasClass('insaddr')) {
                  var old_value = get_offset_flag(r2ui._dis.selected_offset);
                  var type = 'offsets';
                  r2.cmdj('afij @ ' + r2ui._dis.selected_offset, function(x) {
                      if (x !== null && x !== undefined) {
      Severity: Major
      Found in www/p/lib/js/panels/disasm_panel.js and 1 other location - About 2 days to fix
      www/enyo/js/disassembler.js on lines 324..345

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

      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

                  if ($(this.selected).hasClass('insaddr')) {
                      var old_value = get_offset_flag(r2ui._dis.selected_offset);
                      var type = 'offsets';
                      r2.cmdj('afij @ ' + r2ui._dis.selected_offset, function(x) {
                          if (x !== null && x !== undefined) {
      Severity: Major
      Found in www/enyo/js/disassembler.js and 1 other location - About 2 days to fix
      www/p/lib/js/panels/disasm_panel.js on lines 228..249

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

      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

      File disasm.js has 995 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var BBGraph = function() {
          this.vertices = {};
          this.edges = [];
          this.elements = [];
          this.links = [];
      Severity: Major
      Found in www/lib/disasm.js - About 2 days to fix

        File Hexdump.js has 939 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {HexPairNavigator} from './HexPairNavigator';
        import {NavigatorDirection} from '../../core/NavigatorDirection';
        import {RadareInfiniteBlock} from '../../layout/RadareInfiniteBlock';
        import {FlexContainer} from '../../layout/FlexContainer';
        import {WordSizes} from './WordSizes';
        Severity: Major
        Found in www/m/js/modules/hexdump/Hexdump.js - About 2 days to fix

          Function Tiled has 437 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Tiled (id) {
            var obj = document.getElementById(id);
            var self = this;
            this.modal = null;
            this.curframe = undefined;
          Severity: Major
          Found in www/t/js/tiled.js - About 2 days to fix

            Function html_for_instruction has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
            Open

            function html_for_instruction(ins) {
                var idump = '<div class="instruction enyo-selectable">';
                var offset = '0x' + ins.offset.toString(16);
                var address = offset;
                var asm_flags = (r2.settings['asm.flags']);
            Severity: Minor
            Found in www/lib/disasm.js - About 1 day to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            function render_relocs(relocs) {
                var data = [];
                for (var i in relocs) {
                    var r = relocs[i];
                    var rd = {
            Severity: Major
            Found in www/p/lib/js/main.js and 1 other location - About 1 day to fix
            www/p/lib/js/main.js on lines 319..333

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

            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 render_flags(flags) {
                var data = [];
                for (var i in flags) {
                    var f = flags[i];
                    var fd = {
            Severity: Major
            Found in www/p/lib/js/main.js and 1 other location - About 1 day to fix
            www/p/lib/js/main.js on lines 304..318

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

            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 too many statements (118). Maximum allowed is 30.
            Open

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

            enforce a maximum number of statements allowed in function blocks (max-statements)

            The max-statements rule allows you to specify the maximum number of statements allowed in a function.

            function foo() {
              var bar = 1; // one statement
              var baz = 2; // two statements
              var qux = 3; // three statements
            }

            Rule Details

            This rule enforces a maximum number of statements allowed in function blocks.

            Options

            This rule has a number or object option:

            • "max" (default 10) enforces a maximum number of statements allows in function blocks

            Deprecated: The object property maximum is deprecated; please use the object property max instead.

            This rule has an object option:

            • "ignoreTopLevelFunctions": true ignores top-level functions

            max

            Examples of incorrect code for this rule with the default { "max": 10 } option:

            /*eslint max-statements: ["error", 10]*/
            /*eslint-env es6*/
            
            function foo() {
              var foo1 = 1;
              var foo2 = 2;
              var foo3 = 3;
              var foo4 = 4;
              var foo5 = 5;
              var foo6 = 6;
              var foo7 = 7;
              var foo8 = 8;
              var foo9 = 9;
              var foo10 = 10;
            
              var foo11 = 11; // Too many.
            }
            
            let foo = () => {
              var foo1 = 1;
              var foo2 = 2;
              var foo3 = 3;
              var foo4 = 4;
              var foo5 = 5;
              var foo6 = 6;
              var foo7 = 7;
              var foo8 = 8;
              var foo9 = 9;
              var foo10 = 10;
            
              var foo11 = 11; // Too many.
            };

            Examples of correct code for this rule with the default { "max": 10 } option:

            /*eslint max-statements: ["error", 10]*/
            /*eslint-env es6*/
            
            function foo() {
              var foo1 = 1;
              var foo2 = 2;
              var foo3 = 3;
              var foo4 = 4;
              var foo5 = 5;
              var foo6 = 6;
              var foo7 = 7;
              var foo8 = 8;
              var foo9 = 9;
              var foo10 = 10;
              return function () {
            
                // The number of statements in the inner function does not count toward the
                // statement maximum.
            
                return 42;
              };
            }
            
            let foo = () => {
              var foo1 = 1;
              var foo2 = 2;
              var foo3 = 3;
              var foo4 = 4;
              var foo5 = 5;
              var foo6 = 6;
              var foo7 = 7;
              var foo8 = 8;
              var foo9 = 9;
              var foo10 = 10;
              return function () {
            
                // The number of statements in the inner function does not count toward the
                // statement maximum.
            
                return 42;
              };
            }

            ignoreTopLevelFunctions

            Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true } options:

            /*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
            
            function foo() {
              var foo1 = 1;
              var foo2 = 2;
              var foo3 = 3;
              var foo4 = 4;
              var foo5 = 5;
              var foo6 = 6;
              var foo7 = 7;
              var foo8 = 8;
              var foo9 = 9;
              var foo10 = 10;
              var foo11 = 11;
            }

            Related Rules

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

            Function handleKeyPress has a Cognitive Complexity of 75 (exceeds 5 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: Minor
            Found in www/enyo/js/disassembler.js - About 1 day 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 Disassembly.js has 657 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {DisassemblyNavigator} from './DisassemblyNavigator';
            import {RadareInfiniteBlock} from '../../layout/RadareInfiniteBlock';
            import {FlexContainer} from '../../layout/FlexContainer';
            
            import {uiContext} from '../../core/UIContext';
            Severity: Major
            Found in www/m/js/modules/disasm/Disassembly.js - About 1 day to fix

              Function handleKeypress has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
              Open

              function handleKeypress(inEvent) {
                  var keynum = inEvent.keyCode || inEvent.charCode || inEvent.which || 0;
                  var key = String.fromCharCode(keynum);
                  // console.log(key);
              
              
              Severity: Minor
              Found in www/p/lib/js/panels/disasm_panel.js - About 1 day 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_instructions has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
              Open

              function render_instructions(instructions) {
                  var outergbox = document.createElement('div');
                  outergbox.id = 'outergbox';
                  var flatcanvas = document.getElementById('canvas');
                  flatcanvas.innerHTML = '';
              Severity: Minor
              Found in www/lib/disasm.js - About 1 day 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

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

                          if (r2ui._dis.display == 'flat') {
                              next_instruction = $(r2ui._dis.selected).closest('.instructionbox').next().find('.insaddr')[0];
                              if ($('#gbox .instructionbox').index($(r2ui._dis.selected).closest('.instructionbox')[0]) > $('#gbox .instructionbox').length - 10) {
                                  get_more_instructions = true;
                                  address = get_address_from_class(next_instruction);
              Severity: Major
              Found in www/p/lib/js/panels/disasm_panel.js and 1 other location - About 1 day to fix
              www/enyo/js/disassembler.js on lines 245..256

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

              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

                                  if (r2ui._dis.display == 'flat') {
                                      next_instruction = $(r2ui._dis.selected).closest('.instructionbox').next().find('.insaddr')[0];
                                      if ($('#gbox .instructionbox').index($(r2ui._dis.selected).closest('.instructionbox')[0]) > $('#gbox .instructionbox').length - 10) {
                                          get_more_instructions = true;
                                          address = get_address_from_class(next_instruction);
              Severity: Major
              Found in www/enyo/js/disassembler.js and 1 other location - About 1 day to fix
              www/p/lib/js/panels/disasm_panel.js on lines 297..308

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

              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

                          if (r2ui._dis.display == 'graph') {
                              var next_instruction = $(r2ui._dis.selected).closest('.instruction').next().find('.insaddr')[0];
                              if (next_instruction === undefined || next_instruction === null) {
                                  next_instruction = $(r2ui._dis.selected).closest('.basicblock').next().find('.insaddr')[0];
                              }
              Severity: Major
              Found in www/p/lib/js/panels/disasm_panel.js and 1 other location - About 1 day to fix
              www/enyo/js/disassembler.js on lines 257..266

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

              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

                                  if (r2ui._dis.display == 'graph') {
                                      var next_instruction = $(r2ui._dis.selected).closest('.instruction').next().find('.insaddr')[0];
                                      if (next_instruction === undefined || next_instruction === null) {
                                          next_instruction = $(r2ui._dis.selected).closest('.basicblock').next().find('.insaddr')[0];
                                      }
              Severity: Major
              Found in www/enyo/js/disassembler.js and 1 other location - About 1 day to fix
              www/p/lib/js/panels/disasm_panel.js on lines 309..318

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

              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