mckramer/fansite

View on GitHub

Showing 9 of 15 total issues

Method index has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def index
    @events = Event.scoped
    if params[:category]
      category = params[:category]
      if Event::CATEGORY_OPTIONS.include?(category)
Severity: Minor
Found in app/controllers/events_controller.rb - About 1 hr to fix

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

      def index
        @events = Event.scoped
        if params[:category]
          category = params[:category]
          if Event::CATEGORY_OPTIONS.include?(category)
    Severity: Minor
    Found in app/controllers/events_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

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

      def create
        # Retrieve hash from request
        omniauth = request.env["omniauth.auth"]
        
        # Determine if authentication has already been used
    Severity: Minor
    Found in app/controllers/authentications_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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        @media = Medium.scoped
        if params[:form]
          if Medium.form_options.include?(params[:form].to_sym)
            @media = @media.where(form: params[:form])
    Severity: Minor
    Found in app/controllers/media_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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        @month = (params[:month] || (Time.zone || Time).now.month).to_i
        @year = (params[:year] || (Time.zone || Time).now.year).to_i
    
        @today = Date.today
    Severity: Minor
    Found in app/controllers/calendar_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 profile_image_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def profile_image_url(user)
        unless user.authentications.empty?
          # Iterate through and assign the 
          user.authentications.each do |auth|
            case auth.provider
    Severity: Minor
    Found in app/helpers/users_helper.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(user)
        user ||= User.new # guest user (not logged in)
        if user.admin?
          can :manage, :all
        elsif user.editor?
    Severity: Minor
    Found in app/models/ability.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

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

      def updates
        @posts = Post.order('id DESC').limit(5)
        
        @post = Post.order('id DESC').limit(5).sample
        @event = Event.upcoming.sample
    Severity: Minor
    Found in app/controllers/pages_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

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

      def set_user_language
        if params[:locale]
          if I18n.available_locales.include?(params[:locale].to_sym)
            I18n.locale = params[:locale]
          else
    Severity: Minor
    Found in app/controllers/application_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