src/command/KeyBindingManager.js
File KeyBindingManager.js
has 776 lines of code (exceeds 250 allowed). Consider refactoring. Open
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"),
Function _addBinding
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _addBinding(commandID, keyBinding, platform, userBindings) {
var key,
result = null,
normalized,
normalizedDisplay,
Function _applyUserKeyBindings
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _applyUserKeyBindings() {
var remappedCommands = [],
remappedKeys = [],
restrictedCommands = [],
restrictedKeys = [],
Function normalizeKeyDescriptorString
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function normalizeKeyDescriptorString(origDescriptor) {
var hasMacCtrl = false,
hasCtrl = false,
hasAlt = false,
hasShift = false,
Function _mapKeycodeToKey
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function parseDescriptor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
origDescriptor.split("-").forEach(function parseDescriptor(ele, i, arr) {
if (_compareModifierString("ctrl", ele)) {
if (brackets.platform === "mac") {
hasMacCtrl = true;
} else {
Function _translateKeyboardEvent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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),
Function _readUserKeyMap
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _readUserKeyMap() {
var file = FileSystem.getFileForPath(_getUserKeyMapFilePath()),
result = new $.Deferred();
file.exists(function (err, doesExist) {
Function addBinding
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addBinding(command, keyBindings, platform) {
var commandID = "",
results;
if (!command) {
Function _buildKeyDescriptor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function _buildKeyDescriptor(hasMacCtrl, hasCtrl, hasAlt, hasShift, key) {
Avoid too many return
statements within this function. Open
Open
return null;
Avoid too many return
statements within this function. Open
Open
return null;
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
return result;