Showing 51 of 85 total issues
Function Date
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var DateShim = function Date(Y, M, D, h, m, s, ms) {
var length = arguments.length;
var date;
if (this instanceof NativeDate) {
var seconds = s;
Function processOAuthCode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
window.processOAuthCode = function processOAuthCode(data) {
var OAuthSchemeKey = data.state;
// redirect_uri is required in auth code flow
// see https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
Function defineProperties
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var defineProperties = (function (has) {
// Define configurable, writable, and non-enumerable props
// if they don't exist.
var defineProperty;
if (supportsDescriptors) {
Function onOAuthComplete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
if(token) {
if(token.error) {
var checkbox = $('input[type=checkbox],.secured')
checkbox.each(function(pos){
- 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 DateShim
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var DateShim = function Date(Y, M, D, h, m, s, ms) {
Avoid deeply nested control flow statements. Open
Open
if (!loose) loose = next;
Avoid deeply nested control flow statements. Open
Open
for(var i=0; i < requiredScopes.length; i++) {
var s = requiredScopes[i];
if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
diff.push(s);
}
Avoid deeply nested control flow statements. Open
Open
for(i = 0; i < auth.scopes.length; i++) {
scopes.push(auth.scopes[i]);
}
Avoid deeply nested control flow statements. Open
Open
if(o.hasOwnProperty(t) && t === 'implicit') {
var dets = o[t];
var ep = dets.loginEndpoint.url;
url = dets.loginEndpoint.url + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenName;
Avoid deeply nested control flow statements. Open
Open
for (var i = 1; i < arguments.length - 2; i++) {
if (typeof arguments[i] === 'undefined') {
match[i] = void 0;
}
}
Avoid deeply nested control flow statements. Open
Open
if (bull !== b && !(bull.length > 1 && b.length > 1)) {
src = cap.slice(i + 1).join('\n') + src;
i = l - 1;
}
Avoid deeply nested control flow statements. Open
Open
if (Object.prototype.hasOwnProperty.call(source, nextKey)) {
output[nextKey] = source[nextKey];
}
Avoid deeply nested control flow statements. Open
Open
for(scope in auth.scopes) {
scopes.push({scope: scope, description: auth.scopes[scope], OAuthSchemeKey: key});
}
Avoid deeply nested control flow statements. Open
Open
if(inner)
requiredScopes.push(inner);
Avoid deeply nested control flow statements. Open
Open
if(diff.length > 0){
o = v.parentNode.parentNode;
$(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
$(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
Consider simplifying this complex logical expression. Open
Open
if (
'ab'.split(/(?:ab)*/).length !== 2 ||
'.'.split(/(.?)(.?)/).length !== 4 ||
'tesst'.split(/(s)*/)[1] === 't' ||
'test'.split(/(?:)/, -1).length !== 4 ||
Avoid too many return
statements within this function. Open
Open
return this.renderer.blockquote(body);
Avoid too many return
statements within this function. Open
Open
return Parser.parse(Lexer.lex(src, opt), opt);
Avoid too many return
statements within this function. Open
Open
return this.renderer.listitem(body);
Avoid too many return
statements within this function. Open
Open
return this.renderer.paragraph(this.parseText());