bq/corbel-js

View on GitHub

Showing 172 of 172 total issues

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

module.exports = function(grunt) {

  var mountFolder = function(connect, dir) {
    return serveStatic(dir);
  };
Severity: Major
Found in Gruntfile.js - About 2 days to fix

    Function cryptography has 173 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        corbel.cryptography = (function() {
            /*
             * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
             * in FIPS 180-2
             * Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009.
    Severity: Major
    Found in src/cryptography.js - About 6 hrs to fix

      File Gruntfile.js has 421 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      module.exports = function(grunt) {
      
        var mountFolder = function(connect, dir) {
      Severity: Minor
      Found in Gruntfile.js - About 6 hrs to fix

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

                get: function(options) {
                    console.log('composrInterface.request.get');
                    this.options = options || {};
                    return this.request({
                        url: this._buildUri(this.path),
        Severity: Major
        Found in src/composr/requestBuilder.js and 1 other location - About 4 hrs to fix
        src/composr/requestBuilder.js on lines 56..65

        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 118.

        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

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

                delete: function(options) {
                    console.log('composrInterface.request.delete');
                    this.options = options || {};
                    return this.request({
                        url: this._buildUri(this.path),
        Severity: Major
        Found in src/composr/requestBuilder.js and 1 other location - About 4 hrs to fix
        src/composr/requestBuilder.js on lines 33..42

        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 118.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                 _getDevice: function(deviceId) {
                    console.log('iamInterface.user.getDevice');
                    corbel.validate.values(['id', 'deviceId'], {
                        'id':this.id,
                        'deviceId': deviceId
        Severity: Major
        Found in src/iam/usersBuilder.js and 2 other locations - About 4 hrs to fix
        src/iam/usersBuilder.js on lines 283..293
        src/iam/usersBuilder.js on lines 334..344

        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 117.

        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

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

                delete: function(options) {
                    options = this.getDefaultOptions(options);
        
                    var args = corbel.utils.extend(options, {
                        url: this.buildUri(this.type, this.id),
        Severity: Major
        Found in src/resources/resource.js and 1 other location - About 4 hrs to fix
        src/resources/resource.js on lines 35..47

        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 117.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                 _deleteDevice: function(deviceId) {
                     console.log('iamInterface.user.deleteDevice');
                     corbel.validate.values(['id', 'deviceId'], {
                         'id':this.id,
                         'deviceId': deviceId
        Severity: Major
        Found in src/iam/usersBuilder.js and 2 other locations - About 4 hrs to fix
        src/iam/usersBuilder.js on lines 248..258
        src/iam/usersBuilder.js on lines 334..344

        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 117.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                _deleteGroup: function(group) {
                    console.log('iamInterface.user.deleteGroup');
                    corbel.validate.values(['id', 'group'], {
                        'id':this.id,
                        'group': group
        Severity: Major
        Found in src/iam/usersBuilder.js and 2 other locations - About 4 hrs to fix
        src/iam/usersBuilder.js on lines 248..258
        src/iam/usersBuilder.js on lines 283..293

        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 117.

        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

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

                get: function(options) {
                    options = this.getDefaultOptions(options);
                    
        
                    var args = corbel.utils.extend(options, {
        Severity: Major
        Found in src/resources/resource.js and 1 other location - About 4 hrs to fix
        src/resources/resource.js on lines 102..113

        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 117.

        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

        File utils.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        //@exclude
        'use strict';
        //@endexclude
        
        (function() {
        Severity: Minor
        Found in src/utils.js - About 4 hrs to fix

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

                  renewFor: function(userId) {
                      console.log('borrowInterface.resource.renewFor', userId);
                      corbel.validate.values(['id', 'userId'], {
                          'id': this.id,
                          'userId': userId
          Severity: Major
          Found in src/borrow/borrowBuilder.js and 5 other locations - About 4 hrs to fix
          src/borrow/borrowBuilder.js on lines 123..133
          src/borrow/borrowBuilder.js on lines 160..170
          src/borrow/borrowBuilder.js on lines 196..206
          src/borrow/borrowBuilder.js on lines 270..280
          src/borrow/borrowBuilder.js on lines 307..317

          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 115.

          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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

                  returnLoanOf: function(userId) {
                      console.log('borrowInterface.resource.returnLoanOf', userId);
                      corbel.validate.values(['id', 'userId'], {
                          'id': this.id,
                          'userId': userId
          Severity: Major
          Found in src/borrow/borrowBuilder.js and 5 other locations - About 4 hrs to fix
          src/borrow/borrowBuilder.js on lines 123..133
          src/borrow/borrowBuilder.js on lines 160..170
          src/borrow/borrowBuilder.js on lines 233..243
          src/borrow/borrowBuilder.js on lines 270..280
          src/borrow/borrowBuilder.js on lines 307..317

          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 115.

          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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

                  cancelReservationFor: function(userId) {
                      console.log('borrowInterface.resource.cancelReservationFor', userId);
                      corbel.validate.values(['id', 'userId'], {
                          'id': this.id,
                          'userId': userId
          Severity: Major
          Found in src/borrow/borrowBuilder.js and 5 other locations - About 4 hrs to fix
          src/borrow/borrowBuilder.js on lines 123..133
          src/borrow/borrowBuilder.js on lines 160..170
          src/borrow/borrowBuilder.js on lines 196..206
          src/borrow/borrowBuilder.js on lines 233..243
          src/borrow/borrowBuilder.js on lines 270..280

          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 115.

          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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

                  applyFor: function(userId) {
                      console.log('borrowInterface.resource.applyFor', userId);
                      corbel.validate.values(['id', 'userId'], {
                          'id': this.id,
                          'userId': userId
          Severity: Major
          Found in src/borrow/borrowBuilder.js and 5 other locations - About 4 hrs to fix
          src/borrow/borrowBuilder.js on lines 160..170
          src/borrow/borrowBuilder.js on lines 196..206
          src/borrow/borrowBuilder.js on lines 233..243
          src/borrow/borrowBuilder.js on lines 270..280
          src/borrow/borrowBuilder.js on lines 307..317

          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 115.

          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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

                  getLentOf: function(userId) {
                      console.log('borrowInterface.resource.getLentOf', userId);
                      corbel.validate.values(['id', 'userId'], {
                          'id': this.id,
                          'userId': userId
          Severity: Major
          Found in src/borrow/borrowBuilder.js and 5 other locations - About 4 hrs to fix
          src/borrow/borrowBuilder.js on lines 123..133
          src/borrow/borrowBuilder.js on lines 196..206
          src/borrow/borrowBuilder.js on lines 233..243
          src/borrow/borrowBuilder.js on lines 270..280
          src/borrow/borrowBuilder.js on lines 307..317

          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 115.

          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

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

                  delete: function(destId, options) {
                    options = this.getDefaultOptions(options);
          
                    var args = corbel.utils.extend(options, {
                      url: this.buildUri(this.type, this.srcId, this.destType, destId),
          Severity: Major
          Found in src/resources/relation.js and 1 other location - About 4 hrs to fix
          src/resources/relation.js on lines 36..45

          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 115.

          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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

                  reserveFor: function(userId) {
                      console.log('borrowInterface.resource.reserveFor', userId);
                      corbel.validate.values(['id', 'userId'], {
                          'id': this.id,
                          'userId': userId
          Severity: Major
          Found in src/borrow/borrowBuilder.js and 5 other locations - About 4 hrs to fix
          src/borrow/borrowBuilder.js on lines 123..133
          src/borrow/borrowBuilder.js on lines 160..170
          src/borrow/borrowBuilder.js on lines 196..206
          src/borrow/borrowBuilder.js on lines 233..243
          src/borrow/borrowBuilder.js on lines 307..317

          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 115.

          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

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

                   get: function(destId, options) {
                    options = this.getDefaultOptions(options);
                    var args = corbel.utils.extend(options, {
                        url: this.buildUri(this.type, this.srcId, this.destType, destId),
                        method: corbel.request.method.GET,
          Severity: Major
          Found in src/resources/relation.js and 1 other location - About 4 hrs to fix
          src/resources/relation.js on lines 130..140

          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 115.

          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 serializeParams has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            utils.serializeParams = function(params) {
              var result = '';
          
              if (params === undefined || params === null) {
                return result;
          Severity: Major
          Found in src/utils.js - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language