Showing 34 of 55 total issues

File jquery.atwho.js has 709 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//
/*
  Implement Github like autocomplete mentions
  http://ichord.github.com/At.js

Severity: Major
Found in app/javascript/js/libs/jquery.atwho.js - About 1 day to fix

    File qrcode.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @fileoverview
     * - Using the 'QRCode for Javascript library'
     * - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
     * - this library has no dependencies.
    Severity: Minor
    Found in app/javascript/js/libs/qrcode.js - About 5 hrs to fix

      Function ddscrollSpy has 149 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.fn.ddscrollSpy = function(options){
              var $window = $(window)
              var $body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
      
      
      
      Severity: Major
      Found in app/javascript/js/libs/ddscrollspy.js - About 5 hrs to fix

        File jquery.html5-fileupload.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         *  jQuery HTML5 File Upload
         *
         *  Author: timdream at gmail.com
         *  Web: http://timc.idv.tw/html5-file-upload/
        Severity: Minor
        Found in app/javascript/js/libs/jquery.html5-fileupload.js - About 5 hrs to fix

          Function handleFile has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var handleFile = function (settings, file) {
                  var info = {
                      // properties of standard File object || Gecko 1.9 properties
                      type: file.type || '', // MIME type
                      size: file.size || file.fileSize,
          Severity: Major
          Found in app/javascript/js/libs/jquery.html5-fileupload.js - About 4 hrs to fix

            Function handleImage has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var handleImage = function (settings, dataurl, info) {
                    var img = new Image();
                    img.onerror = function () {
                        log('ERROR: <img> failed to load, file is not a supported image format.');
                        settings.fileError.call(this, info, 'FILE_NOT_IMAGE', 'File is not a supported image format.');
            Severity: Major
            Found in app/javascript/js/libs/jquery.html5-fileupload.js - About 3 hrs to fix

              Function onload has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      img.onload = function () {
                          var ratio = Math.max(
                              img.width/settings.imageMaxWidth,
                              img.height/settings.imageMaxHeight,
                              1
              Severity: Major
              Found in app/javascript/js/libs/jquery.html5-fileupload.js - About 3 hrs to fix

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

                    var handleForm = function (settings, type, data, info) {
                        if (canSendFormData && type === 'file') {
                            // FormData API saves the day
                            log('INFO: Using FormData to construct form.');
                            var formdata = new FormData();
                Severity: Major
                Found in app/javascript/js/libs/jquery.html5-fileupload.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                      this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
                  Severity: Critical
                  Found in app/javascript/js/libs/qrcode.js - About 2 hrs to fix

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

                    module.exports = function(api) {
                      var validEnv = ['development', 'test', 'production']
                      var currentEnv = api.env()
                      var isDevelopmentEnv = api.env('development')
                      var isProductionEnv = api.env('production')
                    Severity: Major
                    Found in babel.config.js - About 2 hrs to fix

                      Function fileUpload has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          $.fn.fileUpload = function(settings) {
                              this.each(function(i, el) {
                                  if ($(el).is('input[type=file]')) {
                                      log('INFO: binding onchange event to a input[type=file].');
                                      $(el).bind(
                      Severity: Major
                      Found in app/javascript/js/libs/jquery.html5-fileupload.js - About 2 hrs to fix

                        Function spyonmenuitems has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    function spyonmenuitems($menu){
                                        var $menuitems = $menu.find('a[href^="#"]')
                                        targets = []
                                        curtarget = ''
                                        totaltargetsheight = 0
                        Severity: Minor
                        Found in app/javascript/js/libs/ddscrollspy.js - About 1 hr to fix

                          Function highlightitem has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      function highlightitem(){
                                          if (targets.length == 0)
                                              return
                                          var prevtarget = curtarget
                                          var scrolltop = $spytarget.scrollTop()
                          Severity: Minor
                          Found in app/javascript/js/libs/ddscrollspy.js - About 1 hr to fix

                            Function filter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                              Array.prototype.filter = function(fun /*, thisp */){
                                "use strict";
                            
                                if (this == null)
                                  throw new TypeError();
                            Severity: Minor
                            Found in app/javascript/js/libs/ddscrollspy.js - About 1 hr 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 svgDrawer has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var svgDrawer = (function() {
                            
                                    var Drawing = function (el, htOption) {
                                        this._el = el;
                                        this._htOption = htOption;
                            Severity: Minor
                            Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

                              Function draw has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      Drawing.prototype.draw = function (oQRCode) {
                                          var _elImage = this._elImage;
                                          var _oContext = this._oContext;
                                          var _htOption = this._htOption;
                              
                              
                              Severity: Minor
                              Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

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

                                    var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
                                        var Drawing = function (el, htOption) {
                                            this._el = el;
                                            this._htOption = htOption;
                                        };
                                Severity: Minor
                                Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

                                  Function on_keydown has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        App.prototype.on_keydown = function(e) {
                                          var view, _ref;
                                          view = (_ref = this.controller()) != null ? _ref.view : void 0;
                                          if (!(view && view.visible())) {
                                            return;
                                  Severity: Minor
                                  Found in app/javascript/js/libs/jquery.atwho.js - About 1 hr to fix

                                    Function QR8bitByte has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function QR8bitByte(data) {
                                            this.mode = QRMode.MODE_8BIT_BYTE;
                                            this.data = data;
                                            this.parsedData = [];
                                    
                                    
                                    Severity: Minor
                                    Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

                                      Function drawImage has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                                  CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
                                      Severity: Major
                                      Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language