opengovernment/askthem

View on GitHub

Showing 154 of 154 total issues

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

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.partner-url').length > 0) partnerUrl = jQuery(paramsDiv).find('.partner-url').html();
          } else if (typeof jQuery(this).data('partner-url') !== "undefined") {
            partnerUrl = jQuery(this).data('partner-url');
          }
Severity: Major
Found in public/widgets/zip/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/address/widget.js on lines 230..234
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 247..251
public/widgets/person/widget.js on lines 254..258
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 270..274
public/widgets/person/widget.js on lines 278..282
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 155..159
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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 25 locations. Consider refactoring.
Open

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.question-body').length > 0) questionBody = jQuery(paramsDiv).find('.question-body').html();
          } else if (typeof jQuery(this).data('question-body') !== "undefined") {
            questionBody = jQuery(this).data('question-body');
          }
Severity: Major
Found in public/widgets/address/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 247..251
public/widgets/person/widget.js on lines 254..258
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 270..274
public/widgets/person/widget.js on lines 278..282
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 133..137
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 155..159
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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 25 locations. Consider refactoring.
Open

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.person-political-position-title').length > 0) personPoliticalPositionTitle = jQuery(paramsDiv).find('.person-political-position-title').html();
          } else if (typeof jQuery(this).data('person-political-position-title') !== "undefined") {
            personPoliticalPositionTitle = jQuery(this).data('person-political-position-title');
          }
Severity: Major
Found in public/widgets/person/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/address/widget.js on lines 230..234
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 254..258
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 270..274
public/widgets/person/widget.js on lines 278..282
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 133..137
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 155..159
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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 25 locations. Consider refactoring.
Open

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.person-most-recent-district').length > 0) personMostRecentDistrict = jQuery(paramsDiv).find('.person-most-recent-district').html();
          } else if (typeof jQuery(this).data('person-most-recent-district') !== "undefined") {
            personMostRecentDistrict = jQuery(this).data('person-most-recent-district');
          }
Severity: Major
Found in public/widgets/person/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/address/widget.js on lines 230..234
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 247..251
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 270..274
public/widgets/person/widget.js on lines 278..282
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 133..137
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 155..159
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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 25 locations. Consider refactoring.
Open

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.question-summary').length > 0) questionSummary = jQuery(paramsDiv).find('.question-summary').html();
          } else if (typeof jQuery(this).data('question-summary') !== "undefined") {
            questionSummary = jQuery(this).data('question-summary');
          }
Severity: Major
Found in public/widgets/person/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/address/widget.js on lines 230..234
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 247..251
public/widgets/person/widget.js on lines 254..258
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 278..282
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 133..137
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 155..159
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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 25 locations. Consider refactoring.
Open

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.question-body').length > 0) questionBody = jQuery(paramsDiv).find('.question-body').html();
          } else if (typeof jQuery(this).data('question-body') !== "undefined") {
            questionBody = jQuery(this).data('question-body');
          }
Severity: Major
Found in public/widgets/person/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/address/widget.js on lines 230..234
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 247..251
public/widgets/person/widget.js on lines 254..258
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 270..274
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 133..137
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 155..159
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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 25 locations. Consider refactoring.
Open

          if(paramsDiv) {
            if (jQuery(paramsDiv).find('.headline').length > 0) headline = jQuery(paramsDiv).find('.headline').html();
          } else if (typeof jQuery(this).data('headline') !== "undefined") {
            headline = jQuery(this).data('headline');
          }
Severity: Major
Found in public/widgets/zip/widget.js and 24 other locations - About 3 hrs to fix
public/widgets/address/widget.js on lines 198..202
public/widgets/address/widget.js on lines 206..210
public/widgets/address/widget.js on lines 214..218
public/widgets/address/widget.js on lines 222..226
public/widgets/address/widget.js on lines 230..234
public/widgets/person/widget.js on lines 189..193
public/widgets/person/widget.js on lines 197..201
public/widgets/person/widget.js on lines 205..209
public/widgets/person/widget.js on lines 212..216
public/widgets/person/widget.js on lines 219..223
public/widgets/person/widget.js on lines 226..230
public/widgets/person/widget.js on lines 233..237
public/widgets/person/widget.js on lines 240..244
public/widgets/person/widget.js on lines 247..251
public/widgets/person/widget.js on lines 254..258
public/widgets/person/widget.js on lines 262..266
public/widgets/person/widget.js on lines 270..274
public/widgets/person/widget.js on lines 278..282
public/widgets/widget-builder/widget.js on lines 190..194
public/widgets/widget-builder/widget.js on lines 198..202
public/widgets/zip/widget.js on lines 133..137
public/widgets/zip/widget.js on lines 144..148
public/widgets/zip/widget.js on lines 166..170
public/widgets/zip/widget.js on lines 177..181

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

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

Class QuestionsController has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class QuestionsController < ApplicationController
  before_filter :force_http

  inherit_resources
  belongs_to :jurisdiction, parent_class: Metadatum, finder: :find_by_abbreviation, param: :jurisdiction
Severity: Minor
Found in app/controllers/questions_controller.rb - About 3 hrs to fix

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

      function addCssLinksIfNecessary(cssUrls) {
        jQuery.each(cssUrls, function(key, value) {
          var cssSelector = "link[href='"+ value + "']";
    
          if (!jQuery(cssSelector).length) {
    Severity: Major
    Found in public/widgets/person/widget.js and 2 other locations - About 3 hrs to fix
    public/widgets/address/widget.js on lines 135..149
    public/widgets/widget-builder/widget.js on lines 135..149

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

    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

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

      function addCssLinksIfNecessary(cssUrls) {
        jQuery.each(cssUrls, function(key, value) {
          var cssSelector = "link[href='"+ value + "']";
    
          if (!jQuery(cssSelector).length) {
    Severity: Major
    Found in public/widgets/widget-builder/widget.js and 2 other locations - About 3 hrs to fix
    public/widgets/address/widget.js on lines 135..149
    public/widgets/person/widget.js on lines 135..149

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

    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

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

      function addCssLinksIfNecessary(cssUrls) {
        jQuery.each(cssUrls, function(key, value) {
          var cssSelector = "link[href='"+ value + "']";
    
          if (!jQuery(cssSelector).length) {
    Severity: Major
    Found in public/widgets/address/widget.js and 2 other locations - About 3 hrs to fix
    public/widgets/person/widget.js on lines 135..149
    public/widgets/widget-builder/widget.js on lines 135..149

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

    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

    File questions_controller.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class QuestionsController < ApplicationController
      before_filter :force_http
    
      inherit_resources
      belongs_to :jurisdiction, parent_class: Metadatum, finder: :find_by_abbreviation, param: :jurisdiction
    Severity: Minor
    Found in app/controllers/questions_controller.rb - About 3 hrs to fix

      Function main has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function main() {
          jQuery(document).ready(function($) {
            // We can use jQuery here
      
            // load css, only if it hasn't been loaded
      Severity: Major
      Found in public/widgets/address/widget.js - About 2 hrs to fix

        Function _placeholder_shim has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _placeholder_shim: function(config) {
              function calcPositionCss(target)
              {
                var op = $(target).offsetParent().offset();
                var ot = $(target).offset();
        Severity: Major
        Found in app/assets/javascripts/jquery.html5-placeholder-shim.js - About 2 hrs to fix

          File cached_official.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class CachedOfficial
            include Mongoid::Document
          
            # The person's jurisdiction in askthem
            belongs_to :metadatum, foreign_key: "state"
          Severity: Minor
          Found in app/models/cached_official.rb - About 2 hrs to fix

            Method create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                @question = Question.new(params[:question])
                if @question.person_id.present?
                  @person = @question.person
                  @question.state = @person.state
            Severity: Minor
            Found in app/controllers/questions_controller.rb - About 2 hrs 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 addJSIfNecessary(jsUrls) {
                jQuery.each(jsUrls, function(key, value) {
                  AskThemPersonWidget.jsNecessaryToComplete++;
            
                  jQuery.ajax({
            Severity: Major
            Found in public/widgets/person/widget.js and 2 other locations - About 2 hrs to fix
            public/widgets/address/widget.js on lines 121..133
            public/widgets/widget-builder/widget.js on lines 121..133

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

            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 3 locations. Consider refactoring.
            Open

              function addJSIfNecessary(jsUrls) {
                jQuery.each(jsUrls, function(key, value) {
                  AskThemAddressWidget.jsNecessaryToComplete++;
            
                  jQuery.ajax({
            Severity: Major
            Found in public/widgets/address/widget.js and 2 other locations - About 2 hrs to fix
            public/widgets/person/widget.js on lines 121..133
            public/widgets/widget-builder/widget.js on lines 121..133

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

            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 3 locations. Consider refactoring.
            Open

              function addJSIfNecessary(jsUrls) {
                jQuery.each(jsUrls, function(key, value) {
                  AskThemWidgetBuilderWidget.jsNecessaryToComplete++;
            
                  jQuery.ajax({
            Severity: Major
            Found in public/widgets/widget-builder/widget.js and 2 other locations - About 2 hrs to fix
            public/widgets/address/widget.js on lines 121..133
            public/widgets/person/widget.js on lines 121..133

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

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

                input: function(input) {
                  var $form, $input, binding, event, form, _ref;
                  $input = $(input);
                  form = input.form;
                  $form = $(form);
            Severity: Major
            Found in app/assets/javascripts/rails.validations.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language