chiefy/vaulted

View on GitHub

Showing 7 of 98 total issues

Function createRouter has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function createRouter(app, router) {

  function onError(res, message, error) {
    console.error(message + ': ' + error.message);
    return res.status(error.statusCode || 500).json({
Severity: Major
Found in example/routes.js - About 3 hrs to fix

    File pki.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    var
      Vaulted = {},
      Promise = require('bluebird'),
      _ = require('lodash'),
    Severity: Minor
    Found in lib/backends/pki.js - About 3 hrs to fix

      Function extend has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      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');
      Severity: Minor
      Found in lib/backends/pki.js - About 1 hr to fix

        Function validate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function validate(options) {
          options = options || {};
        
          var invalids = [];
          var check = _.partial(_.includes, ALL_OPTIONS);
        Severity: Minor
        Found in lib/config.js - About 1 hr to fix

          Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          Endpoint.create = function create(url, defaults, apis, verbs, name) {
          Severity: Minor
          Found in lib/endpoint.js - About 35 mins to fix

            Function getProxy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function getProxy(config) {
              var proxy = {};
            
              if (config.has('proxy_address') && config.has('proxy_port')) {
                proxy.hostname = config.get('proxy_address');
            Severity: Minor
            Found in lib/api.js - About 35 mins to fix

            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

            function validateId(verb, options) {
              var idRequired = false;
            
              if (_.has(options, '_required') && options._required === 'id') {
                idRequired = true;
            Severity: Minor
            Found in lib/endpoint.js - About 25 mins to fix

            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

            Severity
            Category
            Status
            Source
            Language