lib/services/swagger-api-service.js
Function swaggerFactory
has 328 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function swaggerFactory(
Promise,
Errors,
_,
injector,
Function swaggerFactory
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
Open
function swaggerFactory(
Promise,
Errors,
_,
injector,
- 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
File swagger-api-service.js
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Copyright 2016, EMC, Inc.
'use strict';
var di = require('di');
Function _render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _render(viewName, req, res) {
var options;
return Promise.try(function() {
assert.optionalString(viewName);
Function makeRenderableOptions
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makeRenderableOptions(req, res, context, ignoreLookup) {
var scope = res.locals.scope;
var apiServer = util.format('http://%s:%d',
config.get('apiServerAddress'),
config.get('apiServerPort')
Function _addLinksHeader
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _addLinksHeader(req, res, count) {
var skip = req.swagger.query.$skip;
var top = req.swagger.query.$top;
var uriBase = req.url.split('?')[0];
Function swaggerFactory
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Promise,
Errors,
_,
injector,
views,
Function swaggerController
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function swaggerController(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
Function swaggerValidator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function swaggerValidator() {
var namespace = '/api/2.0/schemas/';
var schemaPath = path.resolve(__dirname, '../../static/schemas/2.0');
var namespace1Added = schemaApiService.addNamespace(schemaPath, namespace);