SumOfUs/Champaign

View on GitHub

Showing 157 of 338 total issues

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

  def check_hidden(liquid_layout, field)
    if field == :liquid_layout_id
      return 'hidden' unless liquid_layout.primary_layout
    elsif field == :follow_up_liquid_layout_id
      return 'hidden' unless liquid_layout.post_action_layout
Severity: Minor
Found in app/helpers/layout_select_helper.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 build has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.build(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault = false)
Severity: Minor
Found in app/models/payment/braintree.rb - About 45 mins to fix

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

      def create
        recaptcha_resp = verify_recaptcha(secret_key: Settings.recaptcha2.secret_key)
    
        unless recaptcha_resp
          error = { base: [I18n.t('call_tool.errors.recaptcha_fail')] }
    Severity: Minor
    Found in app/controllers/api/calls_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 ensure_required_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def ensure_required_fields
        ensure_has_a_form
        REQUIRED_FIELDS.each do |field|
          next unless fields_with_name(field).empty?
    
    
    Severity: Minor
    Found in app/models/plugins/survey.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 payment_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def payment_options
        {
          nonce: params.require(:payment_method_nonce),
          amount: params.require(:amount).to_f,
          user: user_params,
    Severity: Minor
    Found in app/controllers/api/payment/braintree_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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        sanitize_params!
        @page = Page.find(@params[:page_id])
        build_call_record
        validate_target if errors.blank?
    Severity: Minor
    Found in app/services/call_creator.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 clone has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def self.clone(page, title = nil, language_id = nil, override_forms = false, exclude_shares = false)
    Severity: Minor
    Found in app/services/page_cloner.rb - About 35 mins to fix

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

          def initialize(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault: false)
      Severity: Minor
      Found in app/models/payment/braintree.rb - About 35 mins to fix

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

          def initialize(page, title = nil, language_id = nil, override_forms = false, exclude_shares = false)
        Severity: Minor
        Found in app/services/page_cloner.rb - About 35 mins to fix

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

            def initialize(params, variant_type, page, url = nil, id = nil)
          Severity: Minor
          Found in app/services/share_variant_builder.rb - About 35 mins to fix

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

                def write_transaction(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault: false)
            Severity: Minor
            Found in app/models/payment/braintree.rb - About 35 mins to fix

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

                def initialize(plan, page_slug, follow_up_liquid_layout_id, follow_up_page_slug, extra_params = nil)
              Severity: Minor
              Found in app/services/page_follower.rb - About 35 mins to fix

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

                    def initialize(bt_customer, bt_payment_method, member_id, existing_customer, store_in_vault)
                Severity: Minor
                Found in app/models/payment/braintree.rb - About 35 mins to fix

                  Method create_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create_action
                      action_params = {
                        page: page
                      }.merge(@extra_attrs)
                  
                  
                  Severity: Minor
                  Found in app/services/manage_action.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 csv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def csv
                      rows = @actions.map do |action|
                        keys.map do |k|
                          value = val(k, action)
                          value.is_a?(String) && value.index(COMMA).present? ? "\"#{value}\"" : value
                  Severity: Minor
                  Found in app/services/action_collator.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

                  Function targets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const targets = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(id => {
                    const country = id < 5 ? 'United States' : 'Canada';
                    let state;
                    if (country === 'United States') {
                      state = id < 3 ? 'California' : 'New York';
                  Severity: Minor
                  Found in app/javascript/components/CallTool/call_tool_helpers.test.js - 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 parse_interpolation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def parse_interpolation(query)
                      params = {}
                      depth = 0
                      _, translation_key, string_params = /([^,]+)(.*)/.match(query).to_a
                      while string_params.present? && !string_params.empty?
                  Severity: Minor
                  Found in app/liquid/liquid_i18n.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 all_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def all_params
                      # this method flattens a lot of nested data from one object per form element
                      # to one object per entity (page, share variant, etc) to modify
                      #
                      # this is pretty janky but it's the best I can do moving quickly
                  Severity: Minor
                  Found in app/controllers/api/pages_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

                  Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function(api) {
                    var validEnv = ['development', 'test', 'production'];
                    var currentEnv = api.env();
                    var isDevelopmentEnv = api.env('development');
                    var isProductionEnv = api.env('production');
                  Severity: Minor
                  Found in babel.config.js - 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 round has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def round(values)
                        values.map do |value|
                          value = value.to_f
                  
                          if value < 20
                  Severity: Minor
                  Found in app/lib/donations/utils.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

                  Severity
                  Category
                  Status
                  Source
                  Language