Showing 1,485 of 3,294 total issues
Function _close
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _close(doCloseWindow, reason) {
WebSocketTransport.closeWebSocketServer();
if (_closeDeferred) {
return _closeDeferred;
} else {
Function checkInstallerStatus
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function checkInstallerStatus(requester, searchParams) {
var installErrorStr = searchParams.installErrorStr,
bracketsErrorStr = searchParams.bracketsErrorStr,
updateDirectory = searchParams.updateDir,
encoding = searchParams.encoding || "utf8",
Function checkHealthDataSend
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function checkHealthDataSend(forceSend) {
var result = new $.Deferred(),
isHDTracking = prefs.get("healthDataTracking"),
nextTimeToSend,
currentTime;
Function name
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
returnValue = this;
Function _generatePosition
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_generatePosition: function(event) {
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
// This is another very weird special case that only happens for relative elements:
Function refresh
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
refresh: function() {
// initialize nested menus
var menus,
submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
Function clip
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.effects.effect.clip = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
Function _handleKeydown
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ColorEditor.prototype._handleKeydown = function (event) {
var hasCtrl = (brackets.platform === "win") ? (event.ctrlKey) : (event.metaKey);
if (hasCtrl) {
switch (event.keyCode) {
case KeyEvent.DOM_VK_Z:
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function () {
var extensions = this.props.extensions,
iconClass = extensions && extensions.get("icons") ? "jstree-icons" : "jstree-no-icons",
ulProps = this.props.isRoot ? {
className: "jstree-brackets jstree-no-dots " + iconClass
Function _createIntermediateDirectories
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _createIntermediateDirectories(treeData, path) {
var objectPath = [],
result = {
objectPath: objectPath,
treeData: treeData
Function showProjectPreferencesDialog
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function showProjectPreferencesDialog(baseUrl, errorMessage) {
var $baseUrlControl,
dialog;
// Title
Function off
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var off = function (events, fn) {
if (!this._eventHandlers) {
return this;
}
Function _getExclusionList
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _getExclusionList(editor, constPos) {
var ctxPrev, ctxNext, exclusionList = [], pos, braceParity;
// Move back to find exclusions.
pos = $.extend({}, constPos);
Function when
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = slice.call( arguments ),
length = resolveValues.length,
Function zipWithFactory
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function zipWithFactory(keyIter, zipper, iters) {
var zipSequence = makeSequence(keyIter);
zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();
// Note: this a generic base implementation of __iterate in terms of
// __iterator which may be more generically useful in the future.
Function update
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
var removed = value === NOT_SET;
var entries = this.entries;
var idx = 0;
Function compile
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function compile(userFilter) {
// Automatically apply ** prefix/suffix to make writing simple substring-match filters more intuitive
var wrappedGlobs = userFilter.map(function (glob) {
// Automatic "**" prefix if not explicitly present
if (glob.substr(0, 2) !== "**") {
Function offsetToLineNum
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function offsetToLineNum(textOrLines, offset) {
if (Array.isArray(textOrLines)) {
var lines = textOrLines,
total = 0,
line;
- Read upRead up
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 removeMenuDivider
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Menu.prototype.removeMenuDivider = function (menuItemID) {
var menuItem,
$HTMLMenuItem;
if (!menuItemID) {
Function scanTextUntil
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function scanTextUntil(cm, startCh, startLine, condition) {
var line = cm.getLine(startLine),
seen = "",
characterIndex = startCh,
currentLine = startLine,