cloudspokes/cs-website-cms

View on GitHub

Showing 56 of 93 total issues

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

    def redis_key_for_participants(value)
      if value.is_a?(Hash)
        min = value[:min].blank? ? 0 : value[:min].to_i
        max = value[:max].blank? ? 1000 : value[:max].to_i
        nest[:temp][{participants: value}.hash].tap do |k|
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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(params={})
    # the api names some fields as challenge_xxx where as the payload needs to be xxx
    # params['reviewers'] = params.delete('challenge_reviewers') if params.include? 'challenge_reviewers'
    # params['commentNotifiers'] = params.delete('challenge_comment_notifiers') if params.include? 'challenge_comment_notifiers'
    params['prizes'] = params.delete('challenge_prizes__r') if params.include? 'challenge_prizes__r'
Severity: Minor
Found in app/models/admin/challenge.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 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 new_third_party has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def new_third_party
    if params[:user]
      @signup_form = SignupFormThirdParty.new params[:user]
      if @signup_form.valid?
        create_member_from_third_party @signup_form
Severity: Minor
Found in app/controllers/users/registrations_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 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

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

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

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

              def update
                user = User.find_by_username(params[:user][:username].downcase)
                attributes = params[:user]
                if user and attributes[:password].present? and attributes[:password] == attributes[:password_confirmation]
                  resp = user.account.update_password(attributes[:reset_password_token], attributes[:password])
            Severity: Minor
            Found in app/controllers/users/passwords_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

            Severity
            Category
            Status
            Source
            Language