ruby-grape/grape-swagger-rails

View on GitHub

Showing 51 of 85 total issues

File es5-shim.js has 1509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * https://github.com/es-shims/es5-shim
 * @license es5-shim Copyright 2009-2015 by contributors, MIT License
 * see https://github.com/es-shims/es5-shim/blob/master/LICENSE
 */
Severity: Major
Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 4 days to fix

    File marked.js has 901 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * marked - a markdown parser
     * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
     * https://github.com/chjj/marked
     */
    Severity: Major
    Found in app/assets/javascripts/grape_swagger_rails/marked.js - About 2 days to fix

      Function token has 213 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Lexer.prototype.token = function(src, top, bq) {
        var src = src.replace(/^ +$/gm, '')
          , next
          , loose
          , cap
      Severity: Major
      Found in app/assets/javascripts/grape_swagger_rails/marked.js - About 1 day to fix

        Function handleLogin has 147 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function handleLogin() {
          var scopes = [];
        
          var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
          if(auths) {
        Severity: Major
        Found in app/assets/javascripts/grape_swagger_rails/swagger-oauth.js - About 5 hrs to fix

          Function handleLogin has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

          function handleLogin() {
            var scopes = [];
          
            var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
            if(auths) {
          Severity: Minor
          Found in app/assets/javascripts/grape_swagger_rails/swagger-oauth.js - About 4 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function output has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          InlineLexer.prototype.output = function(src) {
            var out = ''
              , link
              , text
              , href
          Severity: Major
          Found in app/assets/javascripts/grape_swagger_rails/marked.js - About 4 hrs to fix

            Function tok has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Parser.prototype.tok = function() {
              switch (this.token.type) {
                case 'space': {
                  return '';
                }
            Severity: Major
            Found in app/assets/javascripts/grape_swagger_rails/marked.js - About 3 hrs to fix

              File swagger-oauth.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              var appName;
              var popupMask;
              var popupDialog;
              var clientId;
              var realm;
              Severity: Minor
              Found in app/assets/javascripts/grape_swagger_rails/swagger-oauth.js - About 3 hrs to fix

                Function marked has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function marked(src, opt, callback) {
                  if (callback || typeof opt === 'function') {
                    if (!callback) {
                      callback = opt;
                      opt = null;
                Severity: Major
                Found in app/assets/javascripts/grape_swagger_rails/marked.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                                  if (match) {
                                      // parse months, days, hours, minutes, seconds, and milliseconds
                                      // provide default values if necessary
                                      // parse the UTC offset component
                                      var year = $Number(match[1]),
                  Severity: Critical
                  Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 2 hrs to fix

                    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

                                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

                                    Function keys has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            keys: function keys(object) {
                                                var isFn = isCallable(object);
                                                var isArgs = isArguments(object);
                                                var isObject = object !== null && typeof object === 'object';
                                                var isStr = isObject && isString(object);
                                    Severity: Minor
                                    Found in app/assets/javascripts/grape_swagger_rails/es5-shim.js - About 1 hr to fix

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

                                              reduce: function reduce(callbackfn/*, initialValue*/) {
                                                  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