Showing 336 of 336 total issues
Method field
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def field(name, klasses = nil, options = {})
if klasses
klasses = [klasses].flatten
unless klasses.any? {|kl| FIELD_CASTS.key?(kl) }
Method start_child
has a Cognitive Complexity of 11 (exceeds 5 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
- 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 assign_from_old
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def assign_from_old(params, new_params)
queued_deletes = []
params.attributes.each_pair do |name, old_val|
# If there is a new value, see if it has [name]
- 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 run_initial_setup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run_initial_setup(initial_setup)
# Save the changes
if initial_setup
# Run initial validation
if Volt.in_mode?(:no_validate)
- 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 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|