holderdeord/hdo-site

View on GitHub

Showing 302 of 302 total issues

Function createFunctionContext has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    createFunctionContext: function(asObject) {
      var locals = this.stackVars.concat(this.registers.list);

      if(locals.length > 0) {
        this.source[1] = this.source[1] + ", " + locals.join(", ");
Severity: Minor
Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 1 hr to fix

    Method obscure_email has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def obscure_email(email)
        return nil if email.nil?
    
        lower = ('a'..'z').to_a
        upper = ('A'..'Z').to_a
    Severity: Minor
    Found in app/helpers/application_helper.rb - 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 parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            JSON.parse = function (text, reviver) {
    
    // The parse method takes a text and an optional reviver function, and returns
    // a JavaScript value if the text is a valid JSON text.
    
    
    Severity: Minor
    Found in app/assets/javascripts/conditional/json2.js - About 1 hr to fix

      Function writeAnchorTag has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function writeAnchorTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
                  if (m7 == undefined) m7 = "";
                  var whole_match = m1;
                  var link_text = m2.replace(/:\/\//g, "~P"); // to prevent auto-linking withing the link. will be converted back after the auto-linker runs
                  var link_id = m3.toLowerCase();
      Severity: Minor
      Found in app/assets/javascripts/lib/pagedown/Markdown.Converter.js - About 1 hr to fix

        Function replaceStack has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            replaceStack: function(callback) {
              var prefix = '',
                  inline = this.isInline(),
                  stack,
                  createdStack,
        Severity: Minor
        Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 1 hr to fix

          Function setupButton has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function setupButton(button, isEnabled) {
          
                      var normalYShift = "0px";
                      var disabledYShift = "-20px";
                      var highlightYShift = "-40px";
          Severity: Minor
          Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                if ( typeof isScrolling == 'undefined' && !isHorizontal) {
                  isScrolling = !!( isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs( pageX - _this.touches.startX ) )
                }
            Severity: Major
            Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 819..821

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

            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 ( typeof isScrolling == 'undefined' && isHorizontal) {
                  isScrolling = !!( isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs( pageX - _this.touches.startX ) )
                }
            Severity: Major
            Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 822..824

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

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

                commandProto.doHeading = function (chunk, postProcessing) {
            
                    // Remove leading/trailing whitespace and reduce internal spaces to single spaces.
                    chunk.selection = chunk.selection.replace(/\s+/g, " ");
                    chunk.selection = chunk.selection.replace(/(^\s+|\s+$)/g, "");
            Severity: Minor
            Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                  if (axis=='x') {
                    //Crazy IE10 Matrix
                    if (matrix.length==16)
                      curTransform = parseInt( matrix[12], 10 )
                    //Normal Browsers
              Severity: Major
              Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 1321..1328

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

              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 (chunk.endTag) {
                              chunk.endTag = chunk.endTag.replace(/^\n((>|\s)*)\n/,
                                  function (totalMatch, markdown) {
                                      return "\n" + markdown.replace(/^[ ]{0,3}>?[ \t]*$/gm, replacement) + "\n";
                                  });
              Severity: Major
              Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/lib/pagedown/Markdown.Editor.js on lines 1934..1939

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

              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 (chunk.startTag) {
                              chunk.startTag = chunk.startTag.replace(/\n((>|\s)*)\n$/,
                                  function (totalMatch, markdown) {
                                      return "\n" + markdown.replace(/^[ ]{0,3}>?[ \t]*$/gm, replacement) + "\n";
                                  });
              Severity: Major
              Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/lib/pagedown/Markdown.Editor.js on lines 1940..1945

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

              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 (axis=='y') {
                    //Crazy IE10 Matrix
                    if (matrix.length==16)
                      curTransform = parseInt( matrix[13], 10 )
                    //Normal Browsers
              Severity: Major
              Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 1311..1319

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

              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

                    if (params.onSlideClick || params.onSlideTouch) {
                      ;(function () {
                        var el = _this.container;
                        var box = el.getBoundingClientRect();
                        var body = document.body;
              Severity: Critical
              Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js - About 1 hr to fix

                Method stats_for has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def self.stats_for(votes)
                        stats = {
                          representatives: {},
                          parties: {}
                        }
                Severity: Minor
                Found in lib/hdo/stats/rebels.rb - About 1 hr to fix

                  Function _FormParagraphs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function _FormParagraphs(text, doNotUnhash) {
                              //
                              //  Params:
                              //    $text - string to process with html <p> tags
                              //
                  Severity: Minor
                  Found in app/assets/javascripts/lib/pagedown/Markdown.Converter.js - About 1 hr to fix

                    Method proposition_histogram has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def proposition_histogram(opts = {})
                            start_time = opts[:start] || 6.months.ago
                    
                            q = {
                              facets: {
                    Severity: Minor
                    Found in lib/hdo/search/searcher.rb - About 1 hr to fix

                      Method default has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def default
                              @default ||= {
                                analysis: {
                                  analyzer: {
                                    hdo_analyzer: {
                      Severity: Minor
                      Found in lib/hdo/search/settings.rb - About 1 hr to fix

                        Method rebels_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def rebels_for(vote)
                                rebels   = []
                                by_party = vote.
                                  vote_results.
                                  includes(:representative => {:party_memberships => :party}).
                        Severity: Minor
                        Found in lib/hdo/stats/rebels.rb - 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

                          function postJSON(url, params, callbacks) {
                            var options = getOptions.call(this, url, params);
                            var cbs = getCallbacks.call(this, callbacks);
                            JZ.ajax.postJSON(options, cbs);
                          }
                        Severity: Major
                        Found in app/assets/javascripts/lib/server-facade.js and 2 other locations - About 1 hr to fix
                        app/assets/javascripts/lib/server-facade.js on lines 38..42
                        app/assets/javascripts/lib/server-facade.js on lines 44..48

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

                        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