PieceMeta/node-piecemeta-apiclient

View on GitHub

Showing 8 of 8 total issues

Function client has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    module.exports.client = function (httpService, dataParser, apiConfig) {
        var auth = require('./util/auth-header');
        http = httpService;
        parser = dataParser;
        config = apiConfig;
Severity: Major
Found in src/apiclient.js - About 5 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                        function (err, result) {
                            if (typeof callback === 'function') {
                                if (err) {
                                    return callback(err, null);
                                }
    Severity: Major
    Found in src/apiclient.js and 1 other location - About 2 hrs to fix
    src/apiclient.js on lines 134..146

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                            function (err, result) {
                                if (typeof callback === 'function') {
                                    if (err) {
                                        return callback(err, null);
                                    }
    Severity: Major
    Found in src/apiclient.js and 1 other location - About 2 hrs to fix
    src/apiclient.js on lines 79..91

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function resource has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                resource: function (resourceName, query) {
                    return {
                        action: function (method, data, callback, progress) {
                            var path = '/' + resourceName;
    
    
    Severity: Minor
    Found in src/apiclient.js - About 2 hrs to fix

      Function action has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                          action: function (method, data, callback, progress) {
                              var path = '/' + resourceName;
      
                              if (data === null) {
                                  data = undefined;
      Severity: Minor
      Found in src/apiclient.js - About 1 hr to fix

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

            module.exports.request = function (config, callback, progress) {
        
                var parsedUrl = url.parse(config.url);
                var requestSetup = {
                    host: parsedUrl.hostname,
        Severity: Minor
        Found in src/http/node-http.js - About 1 hr to fix

          Function request has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              module.exports.request = function (config, callback, progress) {
                  if (typeof XMLHttpRequest === 'undefined') {
                      if (typeof callback === 'function') {
                          callback(new Error('XMLHttpRequest not available'), null);
                      }
          Severity: Minor
          Found in src/http/xmlhttp.js - About 1 hr to fix

            Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function (grunt) {
                'use strict';
                grunt.initConfig({
                    pkg: grunt.file.readJSON('package.json'),
                    gluejs: {
            Severity: Minor
            Found in Gruntfile.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language