adobe/brackets

View on GitHub
src/command/KeyBindingManager.js

Summary

Maintainability
F
4 days
Test Coverage

File KeyBindingManager.js has 776 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2012 - present Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
Severity: Major
Found in src/command/KeyBindingManager.js - About 1 day to fix

    Function _addBinding has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _addBinding(commandID, keyBinding, platform, userBindings) {
            var key,
                result = null,
                normalized,
                normalizedDisplay,
    Severity: Major
    Found in src/command/KeyBindingManager.js - About 3 hrs to fix

      Function _applyUserKeyBindings has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _applyUserKeyBindings() {
              var remappedCommands   = [],
                  remappedKeys       = [],
                  restrictedCommands = [],
                  restrictedKeys     = [],
      Severity: Major
      Found in src/command/KeyBindingManager.js - About 3 hrs to fix

        Function normalizeKeyDescriptorString has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function normalizeKeyDescriptorString(origDescriptor) {
                var hasMacCtrl = false,
                    hasCtrl = false,
                    hasAlt = false,
                    hasShift = false,
        Severity: Major
        Found in src/command/KeyBindingManager.js - About 2 hrs to fix

          Function _mapKeycodeToKey has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _mapKeycodeToKey(keycode, key) {
                  // If keycode represents one of the digit keys (0-9), then return the corresponding digit
                  // by subtracting KeyEvent.DOM_VK_0 from keycode. ie. [48-57] --> [0-9]
                  if (keycode >= KeyEvent.DOM_VK_0 && keycode <= KeyEvent.DOM_VK_9) {
                      return String(keycode - KeyEvent.DOM_VK_0);
          Severity: Minor
          Found in src/command/KeyBindingManager.js - About 1 hr to fix

            Function parseDescriptor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    origDescriptor.split("-").forEach(function parseDescriptor(ele, i, arr) {
                        if (_compareModifierString("ctrl", ele)) {
                            if (brackets.platform === "mac") {
                                hasMacCtrl = true;
                            } else {
            Severity: Minor
            Found in src/command/KeyBindingManager.js - About 1 hr to fix

              Function _translateKeyboardEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function _translateKeyboardEvent(event) {
                      var hasMacCtrl = (brackets.platform === "mac") ? (event.ctrlKey) : false,
                          hasCtrl = (brackets.platform !== "mac") ? (event.ctrlKey) : (event.metaKey),
                          hasAlt = (event.altKey),
                          hasShift = (event.shiftKey),
              Severity: Minor
              Found in src/command/KeyBindingManager.js - About 1 hr to fix

                Function _readUserKeyMap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function _readUserKeyMap() {
                        var file   = FileSystem.getFileForPath(_getUserKeyMapFilePath()),
                            result = new $.Deferred();
                
                        file.exists(function (err, doesExist) {
                Severity: Minor
                Found in src/command/KeyBindingManager.js - About 1 hr to fix

                  Function addBinding has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function addBinding(command, keyBindings, platform) {
                          var commandID = "",
                              results;
                  
                          if (!command) {
                  Severity: Minor
                  Found in src/command/KeyBindingManager.js - About 1 hr to fix

                    Function _buildKeyDescriptor has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        function _buildKeyDescriptor(hasMacCtrl, hasCtrl, hasAlt, hasShift, key) {
                    Severity: Minor
                    Found in src/command/KeyBindingManager.js - About 35 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return null;
                      Severity: Major
                      Found in src/command/KeyBindingManager.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return null;
                        Severity: Major
                        Found in src/command/KeyBindingManager.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                              return;
                          Severity: Major
                          Found in src/command/KeyBindingManager.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return result;
                            Severity: Major
                            Found in src/command/KeyBindingManager.js - About 30 mins to fix

                              There are no issues that match your filters.

                              Category
                              Status