Showing 371 of 463 total issues
Function clean
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.clean = function( elems, context, fragment, scripts ) {
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
Function toISOString
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Date.prototype.toISOString = function toISOString() {
var result, length, value, year, month;
if (!isFinite(this)) {
throw new RangeError("Date.prototype.toISOString called on non-finite value.");
}
Function $ExceptionHandlerProvider
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.$ExceptionHandlerProvider = function() {
var handler;
/**
* @ngdoc method
Function *
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"*": [function( prop, value ) {
var tween = this.createTween( prop, value ),
target = tween.cur(),
parts = rfxnum.exec( value ),
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
Function off
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
Function clone
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var i, l, srcElements, destElements,
clone = elem.cloneNode( true ),
inPage = jQuery.contains( elem.ownerDocument, elem );
Function offset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
Function serialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function serialize(object) {
var out;
if (angular.isElement(object)) {
object = angular.element(object);
Consider simplifying this complex logical expression. Open
Open
if (value && value.length !== 0) {
var v = lowercase("" + value);
value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
} else {
value = false;
Consider simplifying this complex logical expression. Open
Open
if (decodeURIComponent(match.path) == basePath && !isUndefined(match.hash) &&
match.hash.indexOf(hashPrefix) === 0) {
return url;
// convert html5 url -> hashbang url
} else {
Consider simplifying this complex logical expression. Open
Open
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
Function readSource
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
fs.readFile(path.join(__dirname, "lib", "json3.js"), "utf8", function readSource(exception, source) {
var error, output, compiler, results;
if (exception) {
console.log(exception);
} else {
- 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 compileTemplateUrl
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function compileTemplateUrl(directives, beforeTemplateNodeLinkFn, $compileNode, tAttrs,
$rootElement, replace, childTranscludeFn) {
Function $get
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function( $rootScope, $location, $routeParams, $q, $injector, $http, $templateCache) {
Function Date
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function Date(Y, M, D, h, m, s, ms) {
Function access
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
Function serialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
Avoid deeply nested control flow statements. Open
Open
if (obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key);
}
Avoid deeply nested control flow statements. Open
Open
for(key=0; key<length; key++) {
if (!equals(o1[key], o2[key])) return false;
}
Avoid deeply nested control flow statements. Open
Open
for(key in o1) {
if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
if (!equals(o1[key], o2[key])) return false;
keySet[key] = true;
}