Showing 60 of 66 total issues
Avoid deeply nested control flow statements. Open
if(typeof value !== 'undefined') {
data += '--' + boundary + '\n';
data += 'Content-Disposition: form-data; name="' + key + '"';
data += '\n\n';
data += value + "\n";
Avoid deeply nested control flow statements. Open
if (result === true)
status = true;
Avoid deeply nested control flow statements. 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
if(diff.length > 0){
o = v.parentNode;
$(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
$(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
Function addModels
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
SwaggerResource.prototype.addModels = function(models) {
if (models != null) {
var modelName;
for (modelName in models) {
if (this.models[modelName] == null) {
- 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
Avoid deeply nested control flow statements. Open
if(inner)
requiredScopes.push(inner);
Function getSampleValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
var result;
if ((this.refModel != null) && (modelsToIgnore.indexOf(prop.refModel.name) === -1)) {
result = this.refModel.createJSONSample(modelsToIgnore);
} 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
Avoid deeply nested control flow statements. Open
if(param.allowableValues.values) {
for(var j = 0; j < param.allowableValues.values.length; j++){
var v = param.allowableValues.values[j];
if(param.defaultValue != null) {
param.allowableValues.descriptiveValues.push ({
Function addApiDeclaration
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
SwaggerResource.prototype.addApiDeclaration = function(response) {
if (response.produces != null)
this.produces = response.produces;
if (response.consumes != null)
this.consumes = response.consumes;
- 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 getSignature
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
SwaggerOperation.prototype.getSignature = function(type, models) {
var isPrimitive, listType;
listType = this.isListType(type);
isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true;
if (isPrimitive) {
- 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
Method metadata=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def metadata=(metadata)
fail 'Hash expected' if metadata.class != Hash
fail 'Image does not have an ID' unless metadata['id']
fail 'Image ID mismatch' unless metadata['id'] == id
fail 'Metadata has to contain containter_config' unless metadata.key? 'container_config'
- 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 setConsolidatedModels
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
SwaggerApi.prototype.setConsolidatedModels = function() {
var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results;
this.modelsArray = [];
this.models = {};
_ref = 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 onOAuthComplete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function onOAuthComplete(token) {
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
Avoid too many return
statements within this function. Open
return base + "/" + relativeBasePath;
Function filter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.filter= function(filter, that /*opt*/) {
var other= [], v;
for (var i=0, n= this.length; i<n; i++)
if (i in this && filter.call(that, v= this[i], i, this))
other.push(v);
- 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 isIE8
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
SwaggerHttp.prototype.isIE8 = function() {
var detectedIE = false;
if (typeof navigator !== 'undefined' && navigator.userAgent) {
nav = navigator.userAgent.toLowerCase();
if (nav.indexOf('msie') !== -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 help
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
SwaggerResource.prototype.help = function() {
var op = this.operations;
var output = [];
var operation_name;
for (operation_name in op) {
- 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 indexOf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -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 toSampleValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
SwaggerModelProperty.prototype.toSampleValue = function(value) {
var result;
if (value === "integer") {
result = 0;
} else if (value === "boolean") {
- 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 getAbsoluteBasePath
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
var pos, url;
url = this.api.basePath;
pos = url.lastIndexOf(relativeBasePath);
var parts = url.split("/");
- 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"