Showing 55 of 55 total issues

Avoid deeply nested control flow statements.
Open

    for(var r=-2;r<=2;r++){for(var c=-2;c<=2;c++){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}}}},setupTypeNumber:function(test){var bits=QRUtil.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
Severity: Major
Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

        if(dark==qrCode.isDark(row+r,col+c)){sameCount++;}}}
    Severity: Major
    Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

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

                          targets[i].height = ( parseInt($target.data('spyrange')) > 0 )? parseInt($target.data('spyrange')) : ( $target.outerHeight() || o.mincontentheight)
      Severity: Minor
      Found in app/javascript/js/libs/ddscrollspy.js and 1 other location - About 45 mins to fix
      app/javascript/js/libs/ddscrollspy.js on lines 119..119

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

      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

      Avoid deeply nested control flow statements.
      Open

          var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}
      Severity: Major
      Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

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

                            var targetheight = ( parseInt($target.data('spyrange')) > 0 )? parseInt($target.data('spyrange')) : ( $target.outerHeight() || o.mincontentheight)
        Severity: Minor
        Found in app/javascript/js/libs/ddscrollspy.js and 1 other location - About 45 mins to fix
        app/javascript/js/libs/ddscrollspy.js on lines 194..194

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

        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

        Avoid deeply nested control flow statements.
        Open

            for(var c=-1;c<=1;c++){if(col+c<0||moduleCount<=col+c){continue;}
        Severity: Major
        Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

              this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}
          Severity: Major
          Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex<data.length){dark=(((data[byteIndex]>>>bitIndex)&1)==1);}
            Severity: Major
            Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                  if(r==0&&c==0){continue;}
              Severity: Major
              Found in app/javascript/js/libs/qrcode.js - About 45 mins to fix

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

                                var fOnSuccess = function() {
                                    self._bSupportDataURI = true;
                
                                    if (self._fSuccess) {
                                        self._fSuccess.call(self);
                Severity: Minor
                Found in app/javascript/js/libs/qrcode.js and 1 other location - About 40 mins to fix
                app/javascript/js/libs/qrcode.js on lines 318..324

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

                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 fOnError = function() {
                                    self._bSupportDataURI = false;
                
                                    if (self._fFail) {
                                        self._fFail.call(self);
                Severity: Minor
                Found in app/javascript/js/libs/qrcode.js and 1 other location - About 40 mins to fix
                app/javascript/js/libs/qrcode.js on lines 325..331

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

                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

                Consider simplifying this complex logical expression.
                Open

                    for(var r=-2;r<=2;r++){for(var c=-2;c<=2;c++){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}}}},setupTypeNumber:function(test){var bits=QRUtil.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
                Severity: Major
                Found in app/javascript/js/libs/qrcode.js - About 40 mins to fix

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

                        position: function(pos) {
                          if (document.selection) {
                            return this.getIEPosition(pos);
                          } else {
                            return this.getPosition(pos);
                  Severity: Minor
                  Found in app/javascript/js/libs/jquery.atwho.js and 1 other location - About 40 mins to fix
                  app/javascript/js/libs/jquery.atwho.js on lines 262..268

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

                  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

                        offset: function(pos) {
                          if (document.selection) {
                            return this.getIEOffset(pos);
                          } else {
                            return this.getOffset(pos);
                  Severity: Minor
                  Found in app/javascript/js/libs/jquery.atwho.js and 1 other location - About 40 mins to fix
                  app/javascript/js/libs/jquery.atwho.js on lines 255..261

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

                  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

                  Method admin_active_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def admin_active_for(controller_name, navbar_name)
                      if controller_name.to_s == admin_root_path
                        return controller_name.to_s == navbar_name.to_s ? "active" : ""
                      end
                      navbar_name.to_s.include?(controller_name.to_s) ? 'active' : ''
                  Severity: Minor
                  Found in app/helpers/application_helper.rb - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language