micro-toolkit/api-generator-js

View on GitHub

Showing 8 of 26 total issues

Function fetchEmbed has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function fetchEmbed(relations, config, data, headers){
  var promises = relations.map(function(relation){
    var parent = config.metadata[relation.version][relation.parent];
    var isCollection = isCollectionRelation(relation);
    var isResource = !isCollection;
Severity: Minor
Found in lib/embed.js - About 1 hr to fix

    Function load has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function load(config){
      return {
        collection: function(metadata){
          return collectionHandler(metadata, config);
        },
    Severity: Minor
    Found in lib/handlers.js - About 1 hr to fix

      Function load has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function load(version, modelName, metadata){
        log.trace('Loading Model: version \'%s\' model \'%s\' metadata %j',
          version, modelName, metadata);
      
        // clone the initial dictionary before start changing it
      Severity: Minor
      Found in lib/metadata.js - About 1 hr to fix

        Function init has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function init(modelName, runtimeConfig){
          log.trace('Loading client for model %s', modelName);
          var client = new ZSSClient(getConfig(runtimeConfig, modelName));
        
          return {
        Severity: Minor
        Found in lib/client.js - About 1 hr to fix

          Function promises has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var promises = relations.map(function(relation){
              var parent = config.metadata[relation.version][relation.parent];
              var isCollection = isCollectionRelation(relation);
              var isResource = !isCollection;
              var idKey = isCollection ? parent.idKey : relation.modelFk;
          Severity: Minor
          Found in lib/embed.js - About 1 hr to fix

            Function createHandler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function createHandler(metadata, config, handler, pagination) {
              var includePagination = pagination || false;
              var handlerConfig = getHandlerConfig(metadata, config);
              return function(req, res, next){
                log.trace('Request with params: %j and query: %j', req.params, req.query);
            Severity: Minor
            Found in lib/handlers/factory.js - About 1 hr to fix

              Function load has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function load(config){
                return {
                  collection: function(metadata){
                    var metadataIndex = config.metadata[metadata.version];
                    return getCollectionPath(metadata, metadataIndex);
              Severity: Minor
              Found in lib/paths.js - About 1 hr to fix

                Avoid too many return statements within this function.
                Open

                  return null;
                Severity: Major
                Found in lib/metadata.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language