Showing 12 of 31 total issues
Method initialize
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def initialize(args)
if args.is_a?(String)
# Match `args' against the regular expression, described below.
#
# This regular expression matches all values where the first group of
- 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 initialize
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
if args.length == 1
# Match `string' against the regular expression, described below.
#
# This regular expression matches all values for `string' where
- 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 read
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def read(data, context = {})
# `data` will be a string, so we need to convert it from JSON.
data = JSON.parse(data)
if context[:type] == :single && data.empty?
- 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 create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.create(request, params, post_data = nil)
post_data ||= process_json_request request
if post_data.is_an? Array
results = post_data.map do |post_data_item|
- 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 initialize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(args)
if args.is_a?(String)
# Match `args' against the regular expression, described below.
#
# This regular expression matches all values where the first group of
Method resource_routes
has 35 lines of code (exceeds 25 allowed). Consider refactoring. 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
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
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 create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create(request, params, post_data = nil)
post_data ||= process_json_request request
if post_data.is_an? Array
results = post_data.map do |post_data_item|
Method attribute_routes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. 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"
Further reading
Method update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.update(request, params, post_data = nil)
raise RequestError.new(400, "Must supply a #{model_name.downcase} id!") unless params[:id]
post_data ||= process_json_request request
- 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 get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get(model = nil, query = {})
# Turns something like 'team' into Team.
model = ('FReCon::' + model.capitalize).constantize if model.is_a?(String)
# The route name for the model branch.
- 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"