app/controllers/service_controller.rb
Class ServiceController
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ServiceController < ApplicationController
include Mixins::GenericSessionMixin
include Mixins::GenericShowMixin
include Mixins::GenericListMixin
include Mixins::BreadcrumbsMixin
- Create a ticketCreate a ticket
Method service_delete
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def service_delete
assert_privileges("service_delete")
elements = []
if params[:id] # delete service from its details page
elements.push(params[:id])
- Read upRead up
- Create a ticketCreate a ticket
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_right_cell_vars
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def set_right_cell_vars(action)
case action
when "dialog_provision"
partial = "shared/dialogs/dialog_provision"
header = @right_cell_text
- Create a ticketCreate a ticket
Method set_display
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def set_display
@display = params[:display]
@display ||= default_display unless pagination_or_gtl_request?
@display ||= 'generic_objects' if role_allows?(:feature => "generic_object_view") && @record.number_of(:generic_objects).positive?
end
- Read upRead up
- Create a ticketCreate a ticket
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"