SumOfUs/Champaign

View on GitHub
app/controllers/pages_controller.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class PagesController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class PagesController < ApplicationController # rubocop:disable Metrics/ClassLength
  newrelic_ignore_enduser only: %i[show follow_up double_opt_in_notice]
  skip_before_action :verify_authenticity_token, raise: false, only: %i[create update destroy]
  before_action :authenticate_user!, except: %i[feeds show follow_up double_opt_in_notice]
  before_action :get_page, only: %i[edit update destroy follow_up double_opt_in_notice analytics actions preview emails]
Severity: Minor
Found in app/controllers/pages_controller.rb - About 2 hrs to fix

    Method show has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def show
        respond_to :html
    
        one_click_processor = process_one_click
    
    
    Severity: Minor
    Found in app/controllers/pages_controller.rb - About 1 hr to fix

      Method redirect_to_donations_experiment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def redirect_to_donations_experiment
          return unless @page.published?
          return unless @page.language_code
          return unless @page.donation_page?
          return if user_signed_in?
      Severity: Minor
      Found in app/controllers/pages_controller.rb - About 55 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

      There are no issues that match your filters.

      Category
      Status