Showing 60 of 66 total issues
File swagger.js
has 1430 lines of code (exceeds 250 allowed). Consider refactoring. Open
// swagger.js
// version 2.0.37
var __bind = function(fn, me){
return function(){
Function SwaggerOperation
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
var SwaggerOperation = function(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
var _this = this;
var errors = [];
this.nickname = (nickname||errors.push("SwaggerOperations must have a nickname."));
- 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 SwaggerRequest
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
var _this = this;
var errors = [];
this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
- 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 execute
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
JQueryHttpClient.prototype.execute = function(obj) {
var cb = obj.on;
var request = obj;
obj.type = obj.method;
- 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 setHeaders
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
SwaggerRequest.prototype.setHeaders = function(params, operation) {
// default type
var accepts = "application/json";
var consumes = "application/json";
- 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 addOperations
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes, produces) {
if (ops) {
output = [];
for (var i = 0; i < ops.length; i++) {
o = ops[i];
- 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 SwaggerRequest
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
var _this = this;
var errors = [];
this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
Function SwaggerOperation
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
var SwaggerOperation = function(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
var _this = this;
var errors = [];
this.nickname = (nickname||errors.push("SwaggerOperations must have a nickname."));
Function handleLogin
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleLogin() {
var scopes = [];
if(window.swaggerUi.api.authSchemes
&& window.swaggerUi.api.authSchemes.oauth2
Function apply
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
var status = null;
var key;
// if the "authorizations" key is undefined, or has an empty array, add all keys
- 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 formatXml
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
SwaggerOperation.prototype.formatXml = function(xml) {
var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
reg = /(>)(<)(\/*)/g;
wsexp = /[ ]*(.*)[ ]+\n/g;
contexp = /(<.+>)(.+\n)/g;
Function execute
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
ShredHttpClient.prototype.execute = function(obj) {
if(!this.isInitialized)
this.initShred();
var cb = obj.on, res;
- 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
Class LocalStorageImage
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class LocalStorageImage < BaseImage
PREFIX = 'images'
def path
File.join LocalStorageBackend.storage_path, PREFIX, id
Function getSampleJSON
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
SwaggerOperation.prototype.getSampleJSON = function(type, models) {
var isPrimitive, listType, val;
listType = this.isListType(type);
isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true;
val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample());
- 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 execute
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
JQueryHttpClient.prototype.execute = function(obj) {
var cb = obj.on;
var request = obj;
obj.type = obj.method;
Function setHeaders
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
SwaggerRequest.prototype.setHeaders = function(params, operation) {
// default type
var accepts = "application/json";
var consumes = "application/json";
Function urlify
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
SwaggerOperation.prototype.urlify = function(args) {
var url = this.resource.basePath + this.pathJson();
var params = this.parameters;
for(var i = 0; i < params.length; i ++){
var param = params[i];
- 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 buildFrom1_1Spec
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info");
if (response.apiVersion != null)
this.apiVersion = response.apiVersion;
this.apis = {};
- 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 SwaggerResource
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
var SwaggerResource = function(resourceObj, api) {
var _this = this;
this.api = api;
this.api = this.api;
consumes = (this.consumes | []);
Function onOAuthComplete
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onOAuthComplete(token) {
if(token) {
if(token.error) {
var checkbox = $('input[type=checkbox],.secured')
checkbox.each(function(pos){