Showing 6 of 6 total issues
Class Statuspage
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Statuspage < Handler
config :api_key, required: true
config :page_id, required: true
route(
File statuspage.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Lita
module Handlers
class Statuspage < Handler
config :api_key, required: true
config :page_id, required: true
Method update_incident
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_incident(id, args)
return t('incident.not_found') unless incident(id)
api_args = {}
api_args['incident[status]'] = args['status'] if args.key?('status')
- 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 valid_args?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_args?(args)
return false unless args.key?('name') || args.key?('id')
return false if args.key?('status') &&
!valid_incident_status?(args['status'])
- 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_incident
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_incident(args)
api_args = {}
api_args['incident[name]'] = args['name']
api_args['incident[status]'] = args['status'] if args.key?('status')
api_args['incident[wants_twitter_update]'] = args['twitter'] if args.key?('twitter')
- 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 component
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def component(identifier)
components = api_request('get', 'components')
return unless components && components.count > 0
components.each do |component|
return component if component['id'] == identifier ||
- 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"