autolab/Autolab

View on GitHub
app/assets/javascripts/shortcut.js

Summary

Maintainability
F
3 days
Test Coverage

Function add has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

    'add': function(shortcut_combination,callback,opt) {
        //Provide a set of default options
        var default_options = {
            'type':'keydown',
            'propagate':false,
Severity: Minor
Found in app/assets/javascripts/shortcut.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 add has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    'add': function(shortcut_combination,callback,opt) {
        //Provide a set of default options
        var default_options = {
            'type':'keydown',
            'propagate':false,
Severity: Major
Found in app/assets/javascripts/shortcut.js - About 6 hrs to fix

    Function func has 135 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            var func = function(e) {
                e = e || window.event;
                
                if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
                    var element;
    Severity: Major
    Found in app/assets/javascripts/shortcut.js - About 5 hrs to fix

      Avoid deeply nested control flow statements.
      Open

                              if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
                                  character = shift_nums[character]; 
                                  if(character == k) kp++;
                              }
      Severity: Major
      Found in app/assets/javascripts/shortcut.js - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status