SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

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

  def plugins_config(page)
    return {} unless page

    page.plugins.each_with_object({}) do |plugin, hsh|
      return hsh unless plugin.present?
Severity: Minor
Found in app/helpers/pages_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 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 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 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

    Function handleClick has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      handleClick() {
        const loginHandler = resp => {
          if (
            resp.status !== 'connected' ||
            resp.authResponse.grantedScopes.indexOf('publish_actions') === -1
    Severity: Minor
    Found in app/javascript/legacy/member-facing/backbone/facebook_share_view.js - 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 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 write_subscription has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def write_subscription(payment_method_id, customer_id, subscription_result, page_id, action_id, currency)
    Severity: Minor
    Found in app/models/payment/braintree.rb - About 45 mins to fix

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

          def self.push(event, action, mailing_id)
            case event
            when :new_action
              if action.donation
                if action.form_data.fetch('payment_provider', '').inquiry.go_cardless?
      Severity: Minor
      Found in app/services/action_queue.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 call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def call(env)
          @status, @headers, @response = @app.call(env)
          req = Rack::Request.new(env)
      
          path_match = PathMatcher.match(req.path)
      Severity: Minor
      Found in lib/middleware/pronto.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

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

        try {
          const resp = await localPaymentInstance.startPayment(opts);
          return resp.nonce;
        } catch (e) {
          console.log('LocalPayment ERROR', e);
      Severity: Minor
      Found in app/javascript/components/Payment/ProcessLocalPayment.js and 1 other location - About 45 mins to fix
      app/javascript/components/Payment/IdealPayment.js on lines 25..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      it('renders correctly', () => {
        const wrapper = mountWithIntl(component).find('DonationBands');
        expect(toJson(wrapper)).toMatchSnapshot();
      });
      Severity: Minor
      Found in app/javascript/components/DonationBands/DonationBands.test.js and 1 other location - About 45 mins to fix
      app/javascript/components/DonationBands/DonationBands.test.js on lines 30..33

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        insertHiddenInput(name, value, element) {
          $('<input>')
            .attr({
              type: 'hidden',
              name: name,
      Severity: Minor
      Found in app/javascript/legacy/member-facing/backbone/survey.js and 1 other location - About 45 mins to fix
      app/javascript/legacy/member-facing/backbone/action_form.js on lines 330..338

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        try {
          const resp = await localPaymentInstance.startPayment(opts);
          return resp.nonce;
        } catch (e) {
          console.log('LocalPayment ERROR', e);
      Severity: Minor
      Found in app/javascript/components/Payment/IdealPayment.js and 1 other location - About 45 mins to fix
      app/javascript/components/Payment/ProcessLocalPayment.js on lines 58..63

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        insertHiddenInput(name, value, element) {
          $('<input>')
            .attr({
              type: 'hidden',
              name: name,
      Severity: Minor
      Found in app/javascript/legacy/member-facing/backbone/action_form.js and 1 other location - About 45 mins to fix
      app/javascript/legacy/member-facing/backbone/survey.js on lines 110..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 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      it('renders all amounts with the currency symbol', () => {
        const wrapper = mountWithIntl(component).find('DonationBands');
        expect(toJson(wrapper)).toMatchSnapshot();
      });
      Severity: Minor
      Found in app/javascript/components/DonationBands/DonationBands.test.js and 1 other location - About 45 mins to fix
      app/javascript/components/DonationBands/DonationBands.test.js on lines 25..28

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        module GoCardless
          module WebhookHandler
            class Mandate
              include Processable
      
      
      app/lib/payment_processor/go_cardless/webhook_handler/payment.rb on lines 4..18
      app/lib/payment_processor/go_cardless/webhook_handler/subscription.rb on lines 4..18

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

      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

        module GoCardless
          module WebhookHandler
            class Subscription
              include Processable
      
      
      app/lib/payment_processor/go_cardless/webhook_handler/mandate.rb on lines 4..18
      app/lib/payment_processor/go_cardless/webhook_handler/payment.rb on lines 4..18

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

      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

        module GoCardless
          module WebhookHandler
            class Payment
              include Processable
      
      
      app/lib/payment_processor/go_cardless/webhook_handler/mandate.rb on lines 4..18
      app/lib/payment_processor/go_cardless/webhook_handler/subscription.rb on lines 4..18

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

      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

      Severity
      Category
      Status
      Source
      Language