Showing 7 of 12 total issues
File svg_component.rb
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'clearwater/component'
require 'clearwater/virtual_dom'
module Clearwater
module SVGComponent
Class Router
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Router
attr_reader :window, :location, :history
attr_accessor :application
def initialize options={}, &block
Method sanitize_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.sanitize_attributes attributes
return attributes unless `!!attributes.$$is_hash`
attributes.each do |key, value|
if `key.slice(0, 2)` == 'on'
- 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 match
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def match key, other_parts=[]
if key && (key == self.key || param_key?)
if Array(other_parts).any?
[self, nested_routes[other_parts]]
else
- 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 set_outlets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_outlets targets=targets_for_path(current_path)
return unless application.component.respond_to? :outlet=
trigger_routing_callbacks(path: current_path, previous_path: self.class.previous_path)
- 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 sanitize_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_attributes attributes
return attributes unless attributes.is_a? Hash
if attributes.key? :class_name or attributes.key? :className
attributes[:class] ||= attributes.delete(:class_name) || attributes.delete(:className)
- 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 sanitize_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.sanitize_attributes attributes
return attributes unless `attributes.$$is_hash`
sanitized = attributes.each_with_object({}) do |(key, value), hash|
if svg_attr = SVG_ATTRIBUTES[key]
- 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"