Showing 7 of 98 total issues
Function createRouter
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function createRouter(app, router) {
function onError(res, message, error) {
console.error(message + ': ' + error.message);
return res.status(error.statusCode || 500).json({
File pki.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
var
Vaulted = {},
Promise = require('bluebird'),
_ = require('lodash'),
Function extend
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function extend(Proto) {
Vaulted.getPkiCaDerEndpoint = _.partialRight(
_.partial(Proto.validateEndpoint, '%s/ca'), 'pki');
Vaulted.getPkiCaPemEndpoint = _.partialRight(
_.partial(Proto.validateEndpoint, '%s/ca/pem'), 'pki');
Function validate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function validate(options) {
options = options || {};
var invalids = [];
var check = _.partial(_.includes, ALL_OPTIONS);
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Endpoint.create = function create(url, defaults, apis, verbs, name) {
Function getProxy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function getProxy(config) {
var proxy = {};
if (config.has('proxy_address') && config.has('proxy_port')) {
proxy.hostname = config.get('proxy_address');
- 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 validateId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function validateId(verb, options) {
var idRequired = false;
if (_.has(options, '_required') && options._required === 'id') {
idRequired = true;
- 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"