Showing 55 of 55 total issues

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

                    var targetoffset = (o.spytarget == window)? $target.offset().top : (target.offsetParent == o.spytarget)? target.offsetTop : target.offsetTop - o.spytarget.offsetTop
Severity: Major
Found in app/javascript/js/libs/ddscrollspy.js and 1 other location - About 1 hr to fix
app/javascript/js/libs/ddscrollspy.js on lines 117..117

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

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

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

    return a;},getLengthInBits:function(mode,type){if(1<=type&&type<10){switch(mode){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:return 8;case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+mode);}}else if(type<27){switch(mode){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+mode);}}else if(type<41){switch(mode){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+mode);}}else{throw new Error("type:"+type);}},getLostPoint:function(qrCode){var moduleCount=qrCode.getModuleCount();var lostPoint=0;for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount;col++){var sameCount=0;var dark=qrCode.isDark(row,col);for(var r=-1;r<=1;r++){if(row+r<0||moduleCount<=row+r){continue;}
Severity: Major
Found in app/javascript/js/libs/qrcode.js and 2 other locations - About 1 hr to fix
app/javascript/js/libs/qrcode.js on lines 124..124
app/javascript/js/libs/qrcode.js on lines 124..124

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

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

                  function _getTypeNumber(sText, nCorrectLevel) {
                      var nType = 1;
                      var length = _getUTF8Length(sText);
              
                      for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
              Severity: Minor
              Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

                Function _safeSetDataURI has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function _safeSetDataURI(fSuccess, fFail) {
                            var self = this;
                            self._fFail = fFail;
                            self._fSuccess = fSuccess;
                
                
                Severity: Minor
                Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

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

                          Drawing.prototype.draw = function (oQRCode) {
                              var _htOption = this._htOption;
                              var _el = this._el;
                              var nCount = oQRCode.getModuleCount();
                              var nWidth = Math.floor(_htOption.width / nCount);
                  Severity: Minor
                  Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                        for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount-6;row++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row+1,col)&&qrCode.isDark(row+2,col)&&qrCode.isDark(row+3,col)&&qrCode.isDark(row+4,col)&&!qrCode.isDark(row+5,col)&&qrCode.isDark(row+6,col)){lostPoint+=40;}}}
                    Severity: Major
                    Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount-6;col++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row,col+1)&&qrCode.isDark(row,col+2)&&qrCode.isDark(row,col+3)&&qrCode.isDark(row,col+4)&&!qrCode.isDark(row,col+5)&&qrCode.isDark(row,col+6)){lostPoint+=40;}}}
                      Severity: Major
                      Found in app/javascript/js/libs/qrcode.js - About 1 hr to fix

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

                                        try {
                                            var bin = file.getAsDataURL();
                                        } catch (e) {
                                            log('ERROR: File not readable.');
                                            settings.fileError.call(this, info, 'IO_ERROR', 'File not readable.');
                        Severity: Minor
                        Found in app/javascript/js/libs/jquery.html5-fileupload.js and 1 other location - About 55 mins to fix
                        app/javascript/js/libs/jquery.html5-fileupload.js on lines 213..219

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

                        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

                          (function(factory) {
                            if (typeof define === 'function' && define.amd) {
                              return define(['jquery'], factory);
                            } else {
                              return factory(window.jQuery);
                        Severity: Minor
                        Found in app/javascript/js/libs/jquery.atwho.js and 1 other location - About 55 mins to fix
                        app/javascript/js/libs/jquery.atwho.js on lines 12..280

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

                        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

                                        try {
                                            var bin = file.getAsBinary();
                                        } catch (e) {
                                            log('ERROR: File not readable.');
                                            settings.fileError.call(this, info, 'IO_ERROR', 'File not readable.');
                        Severity: Minor
                        Found in app/javascript/js/libs/jquery.html5-fileupload.js and 1 other location - About 55 mins to fix
                        app/javascript/js/libs/jquery.html5-fileupload.js on lines 222..228

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

                        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

                          (function(factory) {
                            if (typeof define === 'function' && define.amd) {
                              return define(['jquery'], factory);
                            } else {
                              return factory(window.jQuery);
                        Severity: Minor
                        Found in app/javascript/js/libs/jquery.atwho.js and 1 other location - About 55 mins to fix
                        app/javascript/js/libs/jquery.atwho.js on lines 297..855

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

                        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

                                    settings.beforeSend = function (xhr, s) {
                                        s.data = formdata;
                                        if (s.__beforeSend) return s.__beforeSend.call(this, xhr, s);
                                    }
                        Severity: Minor
                        Found in app/javascript/js/libs/jquery.html5-fileupload.js and 1 other location - About 55 mins to fix
                        app/javascript/js/libs/jquery.html5-fileupload.js on lines 406..409

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

                        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

                                        settings.beforeSend = function (xhr, s) {
                                            s.data = blob;
                                            if (s.__beforeSend) return s.__beforeSend.call(this, xhr, s);
                                        };
                        Severity: Minor
                        Found in app/javascript/js/libs/jquery.html5-fileupload.js and 1 other location - About 55 mins to fix
                        app/javascript/js/libs/jquery.html5-fileupload.js on lines 356..359

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

                        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