fatfreecrm/fat_free_crm

View on GitHub
app/controllers/entities_controller.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method get_list_of_records has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def get_list_of_records(options = {})
    options[:query]  ||= params[:query]                        if params[:query]
    self.current_page  = options[:page]                        if options[:page]
    query, tags        = parse_query_and_tags(options[:query])
    self.current_query = query
Severity: Minor
Found in app/controllers/entities_controller.rb - About 3 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

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

class EntitiesController < ApplicationController
  before_action :set_current_tab, only: %i[index show]
  before_action :set_view, only: %i[index show redraw]

  before_action :set_options, only: :index
Severity: Minor
Found in app/controllers/entities_controller.rb - About 2 hrs to fix

    Method get_list_of_records has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def get_list_of_records(options = {})
        options[:query]  ||= params[:query]                        if params[:query]
        self.current_page  = options[:page]                        if options[:page]
        query, tags        = parse_query_and_tags(options[:query])
        self.current_query = query
    Severity: Minor
    Found in app/controllers/entities_controller.rb - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status