Stamplay/stamplay-js-sdk

View on GitHub

Showing 53 of 53 total issues

Function Query has 161 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Query(model, instance) {
        return {
            
            model : model,
            instance : instance,
Severity: Major
Found in src/query.js - About 6 hrs to fix

    File stamplay.tests.ts has 386 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // This file tests the contract defined by the interfaces in stamplay.d.ts against the examples provided by the Stamplay docs
    // Necessary condition (but not sufficient..) for the definition file to be correct is that these examples can be transpiled to javascript without errors by the TypeScript compiler.
    
    // To run the test, use command "tsc stamplay.tests.ts"
    
    
    Severity: Minor
    Found in types/stamplay.tests.ts - About 5 hrs to fix

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

              updateCreditCard : function (userId, token, callbackObject) {
                  if (arguments.length >= 2 && (root.Stamplay.isString(arguments[0]) && root.Stamplay.isString(arguments[1]))) {
                          return root.Stamplay.makeAPromise({
                              method: 'PUT',
                              data: {'token': token},
      Severity: Major
      Found in src/stripe.js and 2 other locations - About 4 hrs to fix
      src/stripe.js on lines 27..37
      src/stripe.js on lines 65..75

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

      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

              createCreditCard : function (userId, token, callbackObject) {
                  if (arguments.length >= 2 && (root.Stamplay.isString(arguments[0]) && root.Stamplay.isString(arguments[1]))) {
                      return root.Stamplay.makeAPromise({
                          method: 'POST',
                          data: {'token': token},
      Severity: Major
      Found in src/stripe.js and 2 other locations - About 4 hrs to fix
      src/stripe.js on lines 38..48
      src/stripe.js on lines 65..75

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

      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

              createSubscription : function (userId, planId, callbackObject) {
                  if (arguments.length >= 2 && (root.Stamplay.isString(arguments[0]) && root.Stamplay.isString(arguments[1]))) {
                      return root.Stamplay.makeAPromise({
                          method: 'POST',
                          data: {'planId': planId},
      Severity: Major
      Found in src/stripe.js and 2 other locations - About 4 hrs to fix
      src/stripe.js on lines 27..37
      src/stripe.js on lines 38..48

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

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

          function Object(resourceId) {
              if (resourceId) {
                  return root.Stamplay.extend({
                      brickId: 'cobject',
                      resourceId: resourceId,
      Severity: Major
      Found in src/cobject.js - About 2 hrs to fix

        Function BaseComponent has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function BaseComponent(brickId, resourceId) {
                
                var removeAttributes = function (brick, instance) {
                    switch (brick) {
                    case 'cobject':
        Severity: Major
        Found in src/baseComponent.js - About 2 hrs to fix

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

                      regex: function(attr, regex, options){
                          var obj = {};
                          obj[attr] = {"$regex":regex, "$options": options};
                          this.whereQuery.push(obj);
                          return this;
          Severity: Major
          Found in src/query.js and 1 other location - About 1 hr to fix
          src/query.js on lines 64..69

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

          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

                      between : function(attr, value1, value2){
                          var obj = {};
                          obj[attr] = {"$gte":value1, "$lte":value2};
                          this.whereQuery.push(obj);
                          return this;
          Severity: Major
          Found in src/query.js and 1 other location - About 1 hr to fix
          src/query.js on lines 137..142

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

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

                  socialLogin: function(provider){
                      if(provider){
                          var url = '/auth/' + root.Stamplay.VERSION + '/' + provider + '/connect';
                          if(root.Stamplay.OPTIONS.isMobile){
                                  //need an external plugin to work - https://github.com/apache/cordova-plugin-inappbrowser
          Severity: Minor
          Found in src/user.js - About 1 hr to fix

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

                            findByCurrentUser: function (attr, data, callbackObject) {
                                var attribute = 'owner';
                                var params = {};
                                var callback;
                                if (arguments.length === 3) {
            Severity: Minor
            Found in src/cobject.js - About 1 hr to fix

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

                  root.Stamplay.makeAPromise = function (options, callback) {
                      if (options.thisParams) {
                          parseQueryParams(options);
                      }        
                      var headerStamplay = root.Stamplay.APPID;
              Severity: Minor
              Found in src/promise.js - About 1 hr to fix

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

                Stamplay.Query("object", "dinners")
                    .near('Point', [74.0059, 40.7127], 500)
                    .exec()
                    .then(function (res) {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 1 other location - About 1 hr to fix
                types/stamplay.tests.ts on lines 479..486

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

                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

                Stamplay.Query("object", "dinners")
                    .nearSphere('Point', [74.0059, 40.7127], 1000)
                    .exec()
                    .then(function (res) {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 1 other location - About 1 hr to fix
                types/stamplay.tests.ts on lines 470..477

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

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

                Stamplay.Query('object', 'movie')
                    .lessThanOrEqual('actions.ratings.total', 4)
                    .exec()
                    .then(function () {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 4 other locations - About 1 hr to fix
                types/stamplay.tests.ts on lines 315..322
                types/stamplay.tests.ts on lines 335..342
                types/stamplay.tests.ts on lines 356..363
                types/stamplay.tests.ts on lines 366..373

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

                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

                Stamplay.Query('object', 'movie')
                    .greaterThanOrEqual('dt_update', "2012-04-11T07:00:00.000Z")
                    .exec()
                    .then(function () {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 1 other location - About 1 hr to fix
                types/stamplay.tests.ts on lines 325..332

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

                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

                Stamplay.Query('object', 'movie')
                    .greaterThan('dt_create', "2015-01-15T08:00:00.000Z")
                    .exec()
                    .then(function () {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 1 other location - About 1 hr to fix
                types/stamplay.tests.ts on lines 345..352

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

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

                Stamplay.Query('object', 'movie')
                    .greaterThan('actions.ratings.total', 4)
                    .exec()
                    .then(function () {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 4 other locations - About 1 hr to fix
                types/stamplay.tests.ts on lines 335..342
                types/stamplay.tests.ts on lines 356..363
                types/stamplay.tests.ts on lines 366..373
                types/stamplay.tests.ts on lines 377..384

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

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

                Stamplay.Query('object', 'movie')
                    .greaterThanOrEqual('actions.ratings.total', 4)
                    .exec()
                    .then(function () {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 4 other locations - About 1 hr to fix
                types/stamplay.tests.ts on lines 315..322
                types/stamplay.tests.ts on lines 356..363
                types/stamplay.tests.ts on lines 366..373
                types/stamplay.tests.ts on lines 377..384

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

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

                Stamplay.Query('object', 'movie')
                    .lessThan('actions.ratings.total', 4)
                    .exec()
                    .then(function () {
                        // success
                Severity: Major
                Found in types/stamplay.tests.ts and 4 other locations - About 1 hr to fix
                types/stamplay.tests.ts on lines 315..322
                types/stamplay.tests.ts on lines 335..342
                types/stamplay.tests.ts on lines 356..363
                types/stamplay.tests.ts on lines 377..384

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

                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