Showing 91 of 5,698 total issues
Function SwaggerOperation
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function SwaggerOperation(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces) {
Function xhrHttp
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var xhrHttp = (function () {
if (typeof window === 'undefined') {
throw new Error('no window object present');
}
else if (window.XMLHttpRequest) {
Function urlify
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SwaggerOperation.prototype.urlify = function(args) {
var param, queryParams, reg, url, _i, _j, _len, _len1, _ref, _ref1;
url = this.resource.basePath + this.pathJson();
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
Function Logger
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Logger = function(options) {
var logger = this;
var options = options||{};
// Default options
Function setCookie
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.setCookie = function setCookie(cookie) {
cookie = Cookie(cookie);
//Delete the cookie if the set is past the current time
var remove = cookie.expiration_date <= Date.now();
if(cookie.name in cookies) {
Function addListener
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
EventEmitter.prototype.addListener = function(type, listener) {
if ('function' !== typeof listener) {
throw new Error('addListener only takes instances of Function');
}
Function showStatus
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
OperationView.prototype.showStatus = function(data) {
var code, content, contentType, headers, pre, response_body;
content = data.content.data;
headers = data.getHeaders();
contentType = headers["Content-Type"];
Function _raw
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
request._raw = http.request(reqParams, function(response) {
request.log.debug("Received response ..");
// We haven't timed out and we have a response, so make sure we clear the
// timeout so it doesn't fire while we're processing the response.
Function compile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
compile: function(environment, options, context, asObject) {
this.environment = environment;
this.options = options || {};
Handlebars.log(Handlebars.logger.DEBUG, this.environment.disassemble() + "\n\n");
Function replaceStack
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
replaceStack: function(callback) {
var prefix = '',
inline = this.isInline(),
stack;
Function SwaggerModelProperty
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SwaggerModelProperty(name, obj) {
this.name = name;
this.dataType = obj.type || obj.dataType || obj["$ref"];
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
this.descr = obj.description;
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Request = module.exports = function (xhr, params) {
var self = this;
self.xhr = xhr;
self.body = '';
Function initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SwaggerUi.prototype.initialize = function(options) {
var _this = this;
if (options == null) {
options = {};
}
Function parseHeaders
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseHeaders (xhr) {
var lines = xhr.getAllResponseHeaders().split(/\r?\n/);
var headers = {};
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
Function define
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
require.define = function (filename, fn) {
var dirname = require._core[filename]
? ''
: require.modules.path().dirname(filename)
;
Function equals
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
equals: function(other) {
var len = this.opcodes.length;
if (other.opcodes.length !== len) {
return false;
}
Function block
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
block: function(block) {
var mustache = block.mustache,
program = block.program,
inverse = block.inverse;
Function SwaggerHttp
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SwaggerHttp() {
var identity, toString,
_this = this;
if (typeof window !== 'undefined') {
this.Shred = require("./shred");
Function SwaggerRequest
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) {
Method flatten_hash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def flatten_hash(hash, results = {}, parent_key = '')
return results unless hash.kind_of?(Hash)
hash.keys.each do |key|
current_key = parent_key.blank? ? key : "#{parent_key}.#{key}"
- 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"