holderdeord/hdo-site

View on GitHub

Showing 302 of 302 total issues

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

            this.selection = this.selection.replace(regex,
                function (match) {
                    chunkObj.startTag = chunkObj.startTag + match;
                    return "";
                });
Severity: Minor
Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js and 1 other location - About 50 mins to fix
app/assets/javascripts/lib/pagedown/Markdown.Editor.js on lines 167..171

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

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

            this.after = this.after.replace(regex,
                function (match) {
                    chunkObj.endTag = match + chunkObj.endTag;
                    return "";
                });
Severity: Minor
Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js and 1 other location - About 50 mins to fix
app/assets/javascripts/lib/pagedown/Markdown.Editor.js on lines 186..190

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

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(!this.depths[depth]) {
        this.depths[depth] = true;
        this.depths.list.push(depth);
      }
Severity: Minor
Found in app/assets/javascripts/lib/handlebars-v1.3.0.js and 1 other location - About 50 mins to fix
app/assets/javascripts/lib/handlebars-v1.3.0.js on lines 2436..2439

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

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(!this.registers[name]) {
        this.registers[name] = true;
        this.registers.list.push(name);
      }
Severity: Minor
Found in app/assets/javascripts/lib/handlebars-v1.3.0.js and 1 other location - About 50 mins to fix
app/assets/javascripts/lib/handlebars-v1.3.0.js on lines 1637..1640

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

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 invokePartial has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
Severity: Minor
Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                          if (this.terminals_[p] && p > 2) {
                              expected.push("'" + this.terminals_[p] + "'");
                          }
    Severity: Major
    Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 45 mins to fix

      Method update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          with_unconfirmed_confirmable do
            if @confirmable.has_no_password?
              if @confirmable.attempt_set_password(params[:representative])
                do_confirm
      Severity: Minor
      Found in app/controllers/confirmations_controller.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                              if (v) {
                                  partial.push(quote(k) + (gap ? ': ' : ':') + v);
                              }
      Severity: Major
      Found in app/assets/javascripts/conditional/json2.js - About 45 mins to fix

        Function invokePartialWrapper has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
        Severity: Minor
        Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 45 mins to fix

          Method by_category has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def by_category(only_main)
                  result = Hash.new { |hash, category| hash[category] = [] }
          
                  @promises.each do |promise|
                    if only_main
          Severity: Minor
          Found in lib/hdo/stats/promise_counts.rb - About 45 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

          Avoid deeply nested control flow statements.
          Open

                      if (_this.positions.current>0) _this.positions.current = 0;
          Severity: Major
          Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (v) {
                                        partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                    }
            Severity: Major
            Found in app/assets/javascripts/conditional/json2.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (v !== undefined) {
                                              value[k] = v;
                                          } else {
                                              delete value[k];
                                          }
              Severity: Major
              Found in app/assets/javascripts/conditional/json2.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if(data) {
                                data.key = key;
                                data.index = i;
                                data.first = (i === 0);
                              }
                Severity: Major
                Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 45 mins to fix

                  Method update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      issue_ids = params[:question][:issues].reject(&:blank?) if params[:question][:issues]
                  
                      @question.issues = Issue.find(issue_ids || [])
                      @question.status = params[:question][:status]
                  Severity: Minor
                  Found in app/controllers/admin/questions_controller.rb - About 45 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

                  Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def initialize(opts = {})
                          opts = opts.dup
                  
                          @votes               = opts.delete(:votes) || Vote.with_results.includes(:propositions)
                          @combinations        = opts.delete(:combinations) || AgreementScorer.combinations
                  Severity: Minor
                  Found in lib/hdo/stats/agreement_scorer.rb - About 45 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

                  Function getLink has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          var getLink = function (wholeMatch, before, inner, afterInner, id, end) {
                  Severity: Minor
                  Found in app/assets/javascripts/lib/pagedown/Markdown.Editor.js - About 45 mins to fix

                    Method csv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def self.csv
                            parties = Party.order(:name).to_a
                    
                            rows = []
                    
                    
                    Severity: Minor
                    Found in lib/hdo/stats/accountability_scorer.rb - About 45 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

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

                            this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
                    Severity: Minor
                    Found in app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js and 1 other location - About 45 mins to fix
                    app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js on lines 53..53

                    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

                    Method navigators has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def navigators
                            data = response.response['aggregations']
                    
                            search_params.map do |param, opts|
                              next if param == :page
                    Severity: Minor
                    Found in lib/hdo/search/facet_search.rb - About 45 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