cloudspokes/cs-website-cms

View on GitHub

Showing 93 of 93 total issues

Avoid deeply nested control flow statements.
Open

                        if(item.name === pickedApi) {
                            break;
                        }
Severity: Major
Found in app/assets/javascripts/mashathon/script.js - About 45 mins to fix

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

        def redis_sorted_ids(set_key, options = {})
          if options[:sort_by]
            sort_options = {}
            sort_options[:by] = nest[:sort][options[:sort_by]]['*']
            order = []
    Severity: Minor
    Found in lib/redis/challenge_searchable.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 getJsConnectString has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def JsConnect.getJsConnectString(user, request = {}, client_id = "", secret = "", secure = true)
    Severity: Minor
    Found in lib/js_connect.rb - About 35 mins to fix

      Method put_apex_rest has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def self.put_apex_rest(url_string, params={}, access_token=nil, user_type=:guest, version='v.9')
      Severity: Minor
      Found in lib/restforce_utils.rb - About 35 mins to fix

        Method upsert_in_salesforce has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def self.upsert_in_salesforce(sobject, params, external_field_name, access_token=nil, user_type=:guest)
        Severity: Minor
        Found in lib/restforce_utils.rb - About 35 mins to fix

          Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def self.perform(access_token, membername, campaign_source, campaign_medium, campaign_name)
          Severity: Minor
          Found in app/workers/marketing_update_new_member.rb - About 35 mins to fix

            Method post_apex_rest has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def self.post_apex_rest(url_string, options, access_token=nil, user_type=:guest, version='v.9')
            Severity: Minor
            Found in lib/restforce_utils.rb - About 35 mins to fix

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

                                  if(isFinished()) {
                                      $('.spinner-wrap .spin-btn').addClass("disabled");
                                      $('.spinner-wrap .intro-text').hide();
                                      $('.spinner-wrap .end-text').show();                
                                  }            
              Severity: Minor
              Found in app/assets/javascripts/mashathon/script.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/mashathon/script.js on lines 226..230

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

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

                      if(isFinished()) {
                          $('.spinner-wrap .spin-btn').addClass("disabled");
                          $('.spinner-wrap .intro-text').hide();
                          $('.spinner-wrap .end-text').show();
                      }
              Severity: Minor
              Found in app/assets/javascripts/mashathon/script.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/mashathon/script.js on lines 277..284

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

              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

                  def redis_key_for_platforms(platforms)
                    keys = platforms.map {|p| nest[:platforms][p]}.compact
              
                    if keys.length > 1
                      nest[:temp][{platforms: platforms}.hash].tap do |k|
              Severity: Minor
              Found in lib/redis/challenge_searchable.rb and 2 other locations - About 35 mins to fix
              lib/redis/challenge_searchable.rb on lines 120..128
              lib/redis/challenge_searchable.rb on lines 144..152

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

              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 comment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def comment
                  comments = params[:comment][:comments]
              
                  if current_user.use_captcha?(@challenge, @current_member_participant)
                    unless verify_recaptcha
              Severity: Minor
              Found in app/controllers/challenges_controller.rb - About 35 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 edit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def edit
              
                  # move the existing assets to a new array
                  @current_assets = @challenge.assets || []
                  # this array will only contain new assets being uploaded  
              Severity: Minor
              Found in app/controllers/admin/challenges_controller.rb - About 35 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 3 locations. Consider refactoring.
              Open

                  def redis_key_for_categories(categories)
                    keys = categories.map {|cat| nest[:categories][cat]}.compact
              
                    if keys.length > 1
                      nest[:temp][{categories: categories}.hash].tap do |k|
              Severity: Minor
              Found in lib/redis/challenge_searchable.rb and 2 other locations - About 35 mins to fix
              lib/redis/challenge_searchable.rb on lines 132..140
              lib/redis/challenge_searchable.rb on lines 144..152

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

              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

                  def redis_key_for_technologies(technologies)
                    keys = technologies.map {|t| nest[:technologies][t]}.compact
              
                    if keys.length > 1
                      nest[:temp][{technologies: technologies}.hash].tap do |k|
              Severity: Minor
              Found in lib/redis/challenge_searchable.rb and 2 other locations - About 35 mins to fix
              lib/redis/challenge_searchable.rb on lines 120..128
              lib/redis/challenge_searchable.rb on lines 132..140

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

              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

                      source.xhr = $.getJSON(source.url + "?callback=?", params, function(json) {
                        source.data = json.response || json;
                        $.proxy(that.filter(source), that)
                      });
              Severity: Minor
              Found in app/assets/javascripts/bootstrap-typeahead.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/bootstrap-typeahead.js on lines 115..118

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

              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

                          success: function(data) {
                            source.data = json.response || json;
                            $.proxy(that.filter(source), that)
                          }
              Severity: Minor
              Found in app/assets/javascripts/bootstrap-typeahead.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/bootstrap-typeahead.js on lines 99..102

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

              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 register has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def register
                  redirect_to challenge_path, :error => 'Registration is closed for this challenge.' if current_challenge.closed_for_registration?
                  # puts CsPlatform.docusign_document(current_user.access_token, current_challenge.docusign_document) if current_challenge.docusign_document    
                  # if default tos, let them register
                  if current_challenge.uses_default_tos?
              Severity: Minor
              Found in app/controllers/challenges_controller.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

              Function validateForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function validateForm() {
              
                var errors = [];
                var startDate = new Date($('#date-range-hidden-start').val());
                var endDate = new Date($('#date-range-hidden-end').val());
              Severity: Minor
              Found in app/assets/javascripts/admin/challenges.js - 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

              Function deleteAsset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function deleteAsset(row, asset_id) {
                $('#' + row).fadeOut();
                $.ajax({
                  type: 'GET',
                  url: '/admin/challenges/delete_asset?asset_id=' + asset_id,
              Severity: Minor
              Found in app/assets/javascripts/admin/challenges.js - 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

              Function validateForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function validateForm() {
              
                var errors = [];
                var startDate = new Date($('#date-range-hidden-start').val());
                var endDate = new Date($('#date-range-hidden-end').val());
              Severity: Minor
              Found in app/assets/javascripts/challenges.js - 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