bq/corbel-js

View on GitHub

Showing 172 of 172 total issues

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

        get: function() {
            console.log('notificationsInterface.domain.get');
            return this.request({
                url: this.buildUri(this.uri),
                method: corbel.request.method.GET
Severity: Major
Found in src/notifications/notificationsDomainBuilder.js and 3 other locations - About 1 hr to fix
src/iam/domainBuilder.js on lines 67..73
src/iam/domainBuilder.js on lines 128..134
src/notifications/notificationsDomainBuilder.js on lines 73..79

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

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

      return this.request({
        url: this._buildUri(this.uri),
        method: corbel.request.method.GET,
        query: params ? corbel.utils.serializeParams(params) : null
      });
Severity: Major
Found in src/ec/productBuilder.js and 2 other locations - About 1 hr to fix
src/iam/clientBuilder.js on lines 97..101
src/iam/usersBuilder.js on lines 486..490

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

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 4 locations. Consider refactoring.
Open

    get: function() {
      console.log('iamInterface.domain.get');
      return this.request({
        url: this._buildUriWithDomain(this.uri),
        method: corbel.request.method.GET
Severity: Major
Found in src/iam/domainBuilder.js and 3 other locations - About 1 hr to fix
src/iam/domainBuilder.js on lines 128..134
src/notifications/notificationsDomainBuilder.js on lines 44..50
src/notifications/notificationsDomainBuilder.js on lines 73..79

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

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

            return this.request({
                url: this._buildUriWithDomain(this.uri),
                method: corbel.request.method.GET,
                query: params ? corbel.utils.serializeParams(params) : null
            });
Severity: Major
Found in src/iam/usersBuilder.js and 2 other locations - About 1 hr to fix
src/ec/productBuilder.js on lines 90..94
src/iam/clientBuilder.js on lines 97..101

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

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 4 locations. Consider refactoring.
Open

        delete: function() {
            console.log('notificationsInterface.domain.delete');
            return this.request({
                url: this.buildUri(this.uri),
                method: corbel.request.method.DELETE
Severity: Major
Found in src/notifications/notificationsDomainBuilder.js and 3 other locations - About 1 hr to fix
src/iam/domainBuilder.js on lines 67..73
src/iam/domainBuilder.js on lines 128..134
src/notifications/notificationsDomainBuilder.js on lines 44..50

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

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

        function binb_sha256(m, l) {
            var HASH = new Array(1779033703, -1150833019, 1013904242, -1521486534,
                1359893119, -1694144372, 528734635, 1541459225);
            var W = new Array(64);
            var a, b, c, d, e, f, g, h;
Severity: Minor
Found in src/cryptography.js - About 1 hr to fix

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

        corbel.validate.isGreaterThan = function(value, greaterThan, message) {
            var gt = this.isValue(value) && value > greaterThan;
    
            if (!gt && message) {
                throw new Error(message);
    Severity: Major
    Found in src/validate.js and 1 other location - About 1 hr to fix
    src/validate.js on lines 124..131

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

    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

        corbel.validate.isGreaterThanOrEqual = function(value, isGreaterThanOrEqual, message) {
            var gte = this.isValue(value) && value >= isGreaterThanOrEqual;
    
            if (!gte && message) {
                throw new Error(message);
    Severity: Major
    Found in src/validate.js and 1 other location - About 1 hr to fix
    src/validate.js on lines 107..114

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

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

      request.send = function (options, driver) {
        options = options || {};
        var module = this;
    
        if (!options.url) {
    Severity: Minor
    Found in src/request.js - About 1 hr to fix

      Function clone has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        utils.clone = function clone(item) {
          if (!item) {
            return item;
          } // null, undefined values check
      
      
      Severity: Minor
      Found in src/utils.js - About 1 hr to fix

        Function processResponse has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var processResponse = function (response, resolver, callbackSuccess, callbackError) {
        
            //xhr = xhr.target || xhr || {};
            var statusCode = xhrSuccessStatus[response.status] || response.status,
              statusType = Number(response.status.toString()[0]),
        Severity: Minor
        Found in src/request.js - About 1 hr to fix

          Function dataURItoBlob has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            utils.dataURItoBlob = function(dataURI) {
          
              var serialize;
              if (corbel.Config.isNode || !root.atob) {
                console.log('NODE');
          Severity: Minor
          Found in src/utils.js - About 1 hr to fix

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

                  if (params.pagination.page || params.pagination.page === 0) {
                    result += result ? '&' : '';
                    result += 'api:page=' + params.pagination.page;
                  }
            Severity: Major
            Found in src/utils.js and 1 other location - About 1 hr to fix
            src/utils.js on lines 301..304

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

            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

                  if (params.pagination.pageSize || params.pagination.pageSize === 0) {
                    result += result ? '&' : '';
                    result += 'api:pageSize=' + params.pagination.pageSize;
                  }
            Severity: Major
            Found in src/utils.js and 1 other location - About 1 hr to fix
            src/utils.js on lines 296..299

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

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

                _buildParams: function (args) {
            
                  // Default values
                  var defaults = {
                    dataType: 'json',
            Severity: Minor
            Found in src/services.js - About 1 hr to fix

              Function _generate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _generate: function(claims, secret, alg){
                          alg = alg || jwt.ALGORITHM;
              
                          // Ensure claims specific order
                          var claimsKeys = [
              Severity: Minor
              Found in src/jwt.js - About 1 hr to fix

                Function readSingleFile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function readSingleFile(evt) {
                    //Retrieve the first (and only!) File from the FileList object
                    var file = evt.target.files[0];
                
                    if (file) {
                Severity: Minor
                Found in examples/webapp/scripts/main.js - About 1 hr to fix

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

                              return this.request({
                                  url: this._buildUriWithDomain(this.uri, this.id) + '/identity',
                                  method: corbel.request.method.POST,
                                  data: identity
                              });
                  Severity: Major
                  Found in src/iam/usersBuilder.js and 1 other location - About 1 hr to fix
                  src/iam/usersBuilder.js on lines 320..324

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

                  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

                              return this.request({
                                  url: this._buildUriWithDomain(this.uri, this.id) + '/group',
                                  method: corbel.request.method.PUT,
                                  data: groups
                              });
                  Severity: Major
                  Found in src/iam/usersBuilder.js and 1 other location - About 1 hr to fix
                  src/iam/usersBuilder.js on lines 193..197

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

                  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

                      corbel.validate.isDefined = function(value, message) {
                          var isUndefined = value === undefined;
                  
                          if (isUndefined && message) {
                              throw new Error(message);
                  Severity: Major
                  Found in src/validate.js and 1 other location - About 1 hr to fix
                  src/validate.js on lines 54..61

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language