lib/frecon/routes.rb
Method has too many lines. [35/30] Open
Open
def self.resource_routes(base, name, controller)
base.post "/#{name}" do
begin
controller.create request, params
rescue RequestError => e
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method resource_routes
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.resource_routes(base, name, controller)
base.post "/#{name}" do
begin
controller.create request, params
rescue RequestError => e
Method included
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.included(base)
resource_routes base, 'teams', TeamsController
resource_routes base, 'competitions', CompetitionsController
resource_routes base, 'matches', MatchesController
resource_routes base, 'records', RecordsController
Method resource_routes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.resource_routes(base, name, controller)
base.post "/#{name}" do
begin
controller.create request, params
rescue RequestError => e
- Read upRead up
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 attribute_routes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.attribute_routes(base, name, controller)
model = controller.model
model_attribute_methods = model.class_variable_get(:@@attributes)
- Read upRead up
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"