Showing 200 of 421 total issues
Consider simplifying this complex logical expression. Open
Open
if (m._isValid == null) {
var flags = getParsingFlags(m);
m._isValid = !isNaN(m._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
Function diff
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function diff( o, n ) {
var ns = new Object();
var os = new Object();
for ( var i = 0; i < n.length; i++ ) {
Function nameToUrl
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
nameToUrl: function (moduleName, ext, skipExt) {
var paths, syms, i, parentModule, url,
parentPath, bundleId,
pkgMain = getOwn(config.pkgs, moduleName);
Function sort
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
sort: ( function() {
var locations, sorted,
dist, i;
function distance( y, uid, type ) {
Function getXhr
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getXhr = function( path ) {
// check if same domain
var sameDomain = true,
domainCheck = /^(\w+:)?\/\/([^\/]+)/.exec( path );
if ( typeof window != 'undefined' && domainCheck ) {
Function edit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
edit: function() {
var evtData = { dialog: this.dialog },
that = this;
// Edit event was blocked or there's no dialog to be automatically opened.
Function popup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
popup: function( url, width, height, options ) {
width = width || '80%';
height = height || '70%';
if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
- 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 init
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init: function( editor ) {
editor.addCommand( 'selectAll', { modes: { wysiwyg: 1, source: 1 },
exec: function( editor ) {
var editable = editor.editable();
Function popup
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
popup: function( url, width, height, options ) {
width = width || '80%';
height = height || '70%';
if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
Function configFromStringAndArray
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function configFromStringAndArray(config) {
var tempConfig,
bestMoment,
scoreToBeat,
Function getSetOffset
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getSetOffset (input, keepLocalTime) {
var offset = this._offset || 0,
localAdjust;
if (input != null) {
if (typeof input === 'string') {
Function setupSelectionObserver
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setupSelectionObserver( widgetsRepo ) {
var editor = widgetsRepo.editor;
editor.on( 'selectionCheck', function() {
widgetsRepo.fire( 'checkSelection' );
Function iso_string__toISOString
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function iso_string__toISOString() {
// for ISO strings we do not use the normal bubbling rules:
// * milliseconds bubble up until they become hours
// * days do not bubble at all
// * months bubble up until they become years
Function Widget
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Widget( widgetsRepo, id, element, widgetDef, startupData ) {
var editor = widgetsRepo.editor;
// Extend this widget with widgetDef-specific methods and properties.
CKEDITOR.tools.extend( this, widgetDef, {
Function bubble
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function bubble () {
var milliseconds = this._milliseconds;
var days = this._days;
var months = this._months;
var data = this._data;
Function startOf
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function startOf (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
Function fromText
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
load.fromText = bind(this, function (text, textAlt) {
/*jslint evil: true */
var moduleName = map.name,
moduleMap = makeModuleMap(moduleName),
hasInteractive = useInteractive;
Function checkWidgets
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function checkWidgets( evt ) {
var options = evt.data;
if ( this.editor.mode != 'wysiwyg' )
return;
Function parseName
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parseName: function (name) {
var modName, ext, temp,
strip = false,
index = name.indexOf("."),
isRelative = name.indexOf('./') === 0 ||
Function _createElement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_createElement: function() {
var notification = this,
notificationElement, notificationMessageElement, notificationCloseElement,
close = this.editor.lang.common.close;