ari/jobsworth

View on GitHub
app/controllers/feeds_controller.rb

Summary

Maintainability
F
4 days
Test Coverage

Method ical has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
Open

  def ical(mode = :personal)
    if params[:id].nil? || params[:id].empty?
      render :nothing => true
      return
    end
Severity: Minor
Found in app/controllers/feeds_controller.rb - About 1 day 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 rss has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

  def rss
    return if params[:id].blank?

    headers['Content-Type'] = 'application/rss+xml'

Severity: Minor
Found in app/controllers/feeds_controller.rb - About 1 day 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 ical has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ical(mode = :personal)
    if params[:id].nil? || params[:id].empty?
      render :nothing => true
      return
    end
Severity: Major
Found in app/controllers/feeds_controller.rb - About 5 hrs to fix

    Method get_action has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_action(log)
        if log.task && log.task_id > 0
          action = 'Completed' if log.event_log.event_type == EventLog::TASK_COMPLETED
          action = 'Reverted' if log.event_log.event_type == EventLog::TASK_REVERTED
          action = 'Created' if log.event_log.event_type == EventLog::TASK_CREATED
    Severity: Minor
    Found in app/controllers/feeds_controller.rb - About 4 hrs 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 rss has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def rss
        return if params[:id].blank?
    
        headers['Content-Type'] = 'application/rss+xml'
    
    
    Severity: Major
    Found in app/controllers/feeds_controller.rb - About 3 hrs to fix

      File feeds_controller.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rss/maker'
      require 'icalendar'
      require 'google_chart'
      
      class FeedsController < ApplicationController
      Severity: Minor
      Found in app/controllers/feeds_controller.rb - About 2 hrs to fix

        There are no issues that match your filters.

        Category
        Status