Showing 316 of 336 total issues
Method validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.validate(model, field_name, args)
errors = {}
value = model.get(field_name)
if args.is_a?(Fixnum)
- 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 start_binding
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def start_binding
binding = ''
open_count = 1
# scan until we reach a {{ or }}
- 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 add_indirect_path
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add_indirect_path(node, path, params)
parts = url_parts(path)
parts.each_with_index do |part, index|
if has_binding?(part)
- 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 current_user_id
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def current_user_id
# Check for a user_id from with_user
if (user_id = Thread.current['with_user_id'])
return user_id
end
- 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 path_for_template
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def path_for_template(lookup_path, force_section = nil)
parts = lookup_path.split('/')
parts_size = parts.size
return nil, nil if parts_size == 0
Method start_child
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_child
# Aquire the write lock, so we prevent anyone from using the child until
# its setup or recreated.
unless @drb_object
# Get the id of the parent process, so we can wait for exit in the child
Function attr
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
attr: function( elem, name, value ) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
Function handlers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
handlers: function( event, handlers ) {
var i, matches, sel, handleObj,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
Function toggleClass
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
Function addClass
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
addClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
Function removeClass
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
Method parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(url)
if url[0] == '#'
# url only updates fragment
self.fragment = url[1..-1]
update!
Method initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(app_path=nil)
app_path ||= Dir.pwd
if Volt.server? && !app_path
raise "Volt::App.new requires an app path to boot"
Function finish
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
Method compute!
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute!(initial_run=false)
@invalidated = false
unless @stopped
Method watch_and_resolve!
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def watch_and_resolve!(success, failure=nil, yield_nil_for_unresolved_promise=false)
# Keep results between runs
result = nil
computation = proc do |comp|
Method url_for
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def url_for(params)
host_with_port = host || location.host
host_with_port += ":#{port}" if port && port != 80
scheme = scheme || location.scheme
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(handler, path, tag_name, attributes, unary)
super(handler, path)
@binding_in_path = path
Method changed
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def changed(attribute_name = nil)
path = @model.path
promise = Promise.new
Method write_files_and_manifest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_files_and_manifest
asset_files = AssetFiles.from_cache(@volt_app.app_url, 'main', @volt_app.component_paths)
# Write a temp css file
js = asset_files.javascript(@volt_app)
css = asset_files.css