ruby-grape/grape-swagger-rails

View on GitHub

Showing 85 of 85 total issues

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

        getMonth: function getMonth() {
            if (!this || !(this instanceof Date)) {
                throw new TypeError('this is not a Date object.');
            }
            var year = originalGetFullYear(this);
Severity: Major
Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 1193..1203

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

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

        getUTCMonth: function getUTCMonth() {
            if (!this || !(this instanceof Date)) {
                throw new TypeError('this is not a Date object.');
            }
            var year = originalGetUTCFullYear(this);
Severity: Major
Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 1156..1166

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

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

        getUTCFullYear: function getUTCFullYear() {
            if (!this || !(this instanceof Date)) {
                throw new TypeError('this is not a Date object.');
            }
            var year = originalGetUTCFullYear(this);
Severity: Major
Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 1146..1155

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

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

        getFullYear: function getFullYear() {
            if (!this || !(this instanceof Date)) {
                throw new TypeError('this is not a Date object.');
            }
            var year = originalGetFullYear(this);
Severity: Major
Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 1183..1192

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

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

    var toFixedShim = function toFixed(fractionDigits) {
        var f, x, s, m, e, z, j, k;

        // Test for NaN and round fractionDigits down
        f = $Number(fractionDigits);
Severity: Major
Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 2 hrs to fix

    Function splice has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            splice: function splice(start, deleteCount) {
                var O = ES.ToObject(this);
                var A = [];
                var len = ES.ToUint32(O.length);
                var relativeStart = ES.ToInteger(start);
    Severity: Major
    Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 2 hrs to fix

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

                  StringPrototype.split = function (separator, limit) {
                      var string = String(this);
                      if (typeof separator === 'undefined' && limit === 0) {
                          return [];
                      }
      Severity: Major
      Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 2 hrs to fix

        Function onOAuthComplete has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
          if(token) {
            if(token.error) {
              var checkbox = $('input[type=checkbox],.secured')
              checkbox.each(function(pos){
        Severity: Major
        Found in app/assets/javascripts/grape_swagger_rails/swagger-oauth.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                              if (
                                  hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) &&
                                  minute < 60 && second < 60 && millisecond < 1000 &&
                                  month > -1 && month < 12 && hourOffset < 24 &&
                                  minuteOffset < 60 && // detect invalid offsets
          Severity: Critical
          Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 2 hrs to fix

            Function parse has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        var parseShim = function parse(string) {
                            var match = isoDateExpression.exec(string);
                            if (match) {
                                // parse months, days, hours, minutes, seconds, and milliseconds
                                // provide default values if necessary
            Severity: Minor
            Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 1 hr to fix

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

                          else if (o.hasOwnProperty(t) && t === 'accessCode') {
                            var dets = o[t];
                            var ep = dets.tokenRequestEndpoint.url;
                            url = dets.tokenRequestEndpoint.url + '?response_type=code';
                            window.swaggerUi.tokenName = dets.tokenName;
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/swagger-oauth.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/swagger-oauth.js on lines 147..158

              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

                          if(o.hasOwnProperty(t) && t === 'implicit') {
                            var dets = o[t];
                            var ep = dets.loginEndpoint.url;
                            url = dets.loginEndpoint.url + '?response_type=token';
                            window.swaggerUi.tokenName = dets.tokenName;
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/swagger-oauth.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/swagger-oauth.js on lines 153..158

              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

                                  if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) {
                                      // work around a Safari 8/9 bug where it treats the seconds as signed
                                      var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
                                      var sToShift = Math.floor(msToShift / 1e3);
                                      seconds += sToShift;
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 1491..1497

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

              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 (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) {
                                  // work around a Safari 8/9 bug where it treats the seconds as signed
                                  var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
                                  var sToShift = Math.floor(msToShift / 1e3);
                                  s += sToShift;
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 1422..1428

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

              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

                  var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; };
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 72..72

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

              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

                  var isRegex; /* inlined from https://npmjs.com/is-regex */ var regexExec = RegExp.prototype.exec, tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }, regexClass = '[object RegExp]'; isRegex = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : to_string.call(value) === regexClass; };
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/es5-shim.js on lines 73..73

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

              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

                  case 'loose_item_start': {
                    var body = '';
              
                    while (this.next().type !== 'list_item_end') {
                      body += this.tok();
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/marked.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/marked.js on lines 1018..1026

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

              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

                  case 'blockquote_start': {
                    var body = '';
              
                    while (this.next().type !== 'blockquote_end') {
                      body += this.tok();
              Severity: Major
              Found in app/assets/javascripts/grape_swagger_rails/marked.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/grape_swagger_rails/marked.js on lines 1048..1056

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

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

                      bind: function bind(that) { // .length is 1
                          // 1. Let Target be the this value.
                          var target = this;
                          // 2. If IsCallable(Target) is false, throw a TypeError exception.
                          if (!isCallable(target)) {
              Severity: Minor
              Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 1 hr to fix

                Function reduceRight has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        reduceRight: function reduceRight(callbackfn/*, initial*/) {
                            var object = ES.ToObject(this);
                            var self = splitString && isString(this) ? strSplit(this, '') : object;
                            var length = ES.ToUint32(self.length);
                
                
                Severity: Minor
                Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language