radare/radare2-webui

View on GitHub

Showing 2,691 of 2,691 total issues

Function drawContextualMenu has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    drawContextualMenu() {
        var exportOp = (name, range, command, ext) => {
            var output;
            r2.cmd(command + ' ' + (range.to - range.from) + ' @' + range.from, (d) => { output = d; });

Severity: Minor
Found in www/m/js/modules/hexdump/Hexdump.js - 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 drawChunk has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in www/m/js/modules/hexdump/Hexdump.js - 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 hex_menu_to_console has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function hex_menu_to_console() {
    value = '';
    if (r2ui._hex.dragEnd > -1 && r2ui._hex.dragStart > -1) {
        if (r2ui._hex.dragEnd + 1 < r2ui._hex.dragStart) { // reverse select
            var cells = $('span.dword').slice(r2ui._hex.dragEnd, r2ui._hex.dragStart + 1).addClass('autohighlighti');
Severity: Minor
Found in www/p/lib/js/panels/hex_panel.js - 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

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

    draw() {
        this.node.innerHTML = '';
        this.node.scrollTop = 0;
        this.node.appendChild(this.getPanel());
    }
Severity: Major
Found in www/m/js/widgets/FlagsWidget.js and 3 other locations - About 1 hr to fix
www/m/js/widgets/ClassesWidget.js on lines 23..27
www/m/js/widgets/DebuggerWidget.js on lines 26..30
www/m/js/widgets/FunctionsWidget.js on lines 24..28

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

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

    JqTreeWidget.prototype.addNodeBefore = function(new_node_info, existing_node) {
      var new_node;
      new_node = existing_node.addBefore(new_node_info);
      this._refreshElements(existing_node.parent);
      return new_node;
Severity: Major
Found in www/p/lib/js/dependencies/tree.jquery.js and 2 other locations - About 1 hr to fix
www/p/lib/js/dependencies/tree.jquery.js on lines 1329..1334
www/p/lib/js/dependencies/tree.jquery.js on lines 1343..1348

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

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

    draw() {
        this.node.innerHTML = '';
        this.node.scrollTop = 0;
        this.node.appendChild(this.getPanel());
    }
Severity: Major
Found in www/m/js/widgets/FunctionsWidget.js and 3 other locations - About 1 hr to fix
www/m/js/widgets/ClassesWidget.js on lines 23..27
www/m/js/widgets/DebuggerWidget.js on lines 26..30
www/m/js/widgets/FlagsWidget.js on lines 23..27

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

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

    draw() {
        this.node.innerHTML = '';
        this.node.scrollTop = 0;
        this.node.appendChild(this.getPanel());
    }
Severity: Major
Found in www/m/js/widgets/ClassesWidget.js and 3 other locations - About 1 hr to fix
www/m/js/widgets/DebuggerWidget.js on lines 26..30
www/m/js/widgets/FlagsWidget.js on lines 23..27
www/m/js/widgets/FunctionsWidget.js on lines 24..28

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

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

    JqTreeWidget.prototype.addParentNode = function(new_node_info, existing_node) {
      var new_node;
      new_node = existing_node.addParent(new_node_info);
      this._refreshElements(new_node.parent);
      return new_node;
Severity: Major
Found in www/p/lib/js/dependencies/tree.jquery.js and 2 other locations - About 1 hr to fix
www/p/lib/js/dependencies/tree.jquery.js on lines 1329..1334
www/p/lib/js/dependencies/tree.jquery.js on lines 1336..1341

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

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

    JqTreeWidget.prototype.addNodeAfter = function(new_node_info, existing_node) {
      var new_node;
      new_node = existing_node.addAfter(new_node_info);
      this._refreshElements(existing_node.parent);
      return new_node;
Severity: Major
Found in www/p/lib/js/dependencies/tree.jquery.js and 2 other locations - About 1 hr to fix
www/p/lib/js/dependencies/tree.jquery.js on lines 1336..1341
www/p/lib/js/dependencies/tree.jquery.js on lines 1343..1348

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

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

    draw() {
        this.node.innerHTML = '';
        this.node.scrollTop = 0;
        this.node.appendChild(this.getPanel());
    }
Severity: Major
Found in www/m/js/widgets/DebuggerWidget.js and 3 other locations - About 1 hr to fix
www/m/js/widgets/ClassesWidget.js on lines 23..27
www/m/js/widgets/FlagsWidget.js on lines 23..27
www/m/js/widgets/FunctionsWidget.js on lines 24..28

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

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

DisasmPanel.prototype.handleInputTextChange = function() {
    if (this.renaming !== null && this.rbox.value.length > 0) {
        if ($(this.selected).hasClass('insaddr')) {
            var old_value = get_offset_flag(r2ui._dis.selected_offset);
            var type = 'offsets';
Severity: Minor
Found in www/p/lib/js/panels/disasm_panel.js - About 1 hr to fix

    Function getPanel has 31 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: Minor
    Found in www/m/js/widgets/CommentsWidget.js - About 1 hr to fix

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

          drawEmptyDialog() {
              var _this = this;
              this.dialog = document.createElement('dialog');
              this.dialog.className = 'mdl-dialog';
      
      
      Severity: Minor
      Found in www/m/js/layout/FlexContainer.js - About 1 hr to fix

        Function createTree has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        TypesPanel.prototype.createTree = function() {
            var $tree = $('#types');
            $tree.tree({
                data: this.data,
                slide: false,
        Severity: Minor
        Found in www/p/lib/js/panels/types_panel.js - About 1 hr to fix

          Function render_functions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function render_functions(functions) {
              var imports = null;
              r2.cmdj('iij', function(x) {
                  imports = x;
              });
          Severity: Minor
          Found in www/p/lib/js/main.js - About 1 hr to fix

            Function handleInputTextChange has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                handleInputTextChange: function() {
                    if (this.renaming !== null && this.rbox.value.length > 0) {
                        if ($(this.selected).hasClass('insaddr')) {
                            var old_value = get_offset_flag(r2ui._dis.selected_offset);
                            var type = 'offsets';
            Severity: Minor
            Found in www/enyo/js/disassembler.js - About 1 hr to fix

              Function goToAddress has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  goToAddress: function() {
                      if (this.renaming === null && this.selected !== null && (this.selected.className.indexOf(' addr ')) - 1) {
                          var address = get_address_from_class(this.selected);
                          if (this.selected.className.indexOf('ec_dataoffset') > -1) {
                              // address is located in not executable memory, switching to hex view
              Severity: Minor
              Found in www/enyo/js/disassembler.js - About 1 hr to fix

                Function _init has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    JqTreeWidget.prototype._init = function() {
                      JqTreeWidget.__super__._init.call(this);
                      this.element = this.$el;
                      this.mouse_delay = 300;
                      this.is_initialized = false;
                Severity: Minor
                Found in www/p/lib/js/dependencies/tree.jquery.js - About 1 hr to fix

                  Function openPage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      openPage: function(idx) {
                          var str, sp = this.$.panels;
                          // TODO: this is just a hack
                          var r = -1;
                          switch (idx) {
                  Severity: Minor
                  Found in www/enyo/js/mainpanel.js - About 1 hr to fix

                    Function applyFlags has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        applyFlags(lines, blockInitialOffset, flags) {
                            if (!this.showFlags) {
                                return;
                            }
                    
                    
                    Severity: Minor
                    Found in www/m/js/modules/hexdump/Hexdump.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language