Showing 19 of 23 total issues
Class TransporterJob
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class TransporterJob < ActiveRecord::Base
include ITunes::Store::Transporter::Web
STATES = [:queued, :running, :success, :failure]
STATES.each do |s|
Method prompt_for_config
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def prompt_for_config
unless $config[:db_driver]
puts "Select your database: "
$supported_drivers.each_with_index { |dep, i| puts "#{i + 1}: #{dep.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
Function fileBrowser
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.fileBrowser = function(o, handler) {
if( !o ) var o = {};
if( o.root == undefined ) o.root = '';
if( o.script == undefined ) o.script = 'browse';
if( o.title == undefined ) o.title = 'Select a File';
Method current_search_query
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def current_search_query(accounts)
terms = []
[:priority, :state, :target, :type].each do |name|
next if params[name].blank?
- 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 find
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def find(path, options)
files = []
Dir.foreach(path) do |name|
next if name =~ %r|\A\.\.?|
- 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 install
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install
puts "Installing..."
db_driver = $config[:db_driver] || $default_driver
db_config = {
Function bindTree
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var bindTree = function(t) {
$(t).find('LI A').bind('click', function() {
var count = ($(this).data('clickcount') || 0) + 1;
if(count == 1) {
Method current_search_query
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def current_search_query(accounts)
terms = []
[:priority, :state, :target, :type].each do |name|
next if params[name].blank?
Method install
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def install
puts "Installing..."
db_driver = $config[:db_driver] || $default_driver
db_config = {
- 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 sort_by
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def sort_by(column)
current_column, current_dir = params[:order].to_s.split(":")
dir = current_dir == "asc" ? "desc" : "asc"
link = link_to(column.titleize, current_path(params.merge(:order => "#{column}:#{dir}")))
- 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 to_bool
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_bool(val)
case val
when String
val == "true" || val == "1" ? true : false
when 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
Consider simplifying this complex logical expression. Open
if (element.data('remote') == true) {
e.preventDefault(); e.stopped = true;
JSAdapter.sendRequest(element, {
verb: element.data('method') || element.attr('method') || 'post',
url: element.attr('action'),
Method account_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def account_options(accounts)
options = []
Array(accounts).sort_by { |u| u.username }.group_by(&:username).each do |_, users|
users.each do |u|
- 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 format_option_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def format_option_value(name, value)
if name == :rate && value.present?
number_with_delimiter(value) << " Kbps"
elsif name == :password
"*" * 8
- 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 as_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def as_json(options = nil)
return super if options
json = super(:except => [:job_id, :target, :output_log_file])
if json["options"]
- 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 ls
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ls(path, options = {})
roots = options[:root] ? Array(options[:root]) : root_directory
return roots if path.to_s.empty?
# Make sure path starts with one of the roots, checking the longest one first.
- 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 marshal_dump
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def marshal_dump
options = super.dup.except(:account_id, :execute)
if @account
- 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 check_package
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_package
if batch == "1" && !package.end_with?(".itmsp")
errors[:package] << 'does not contain any ".itmsp" directories' unless contains_packages?(package)
elsif !package.end_with?(".itmsp")
errors[:package] << 'must end with ".itmsp"'
- 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 file_browser_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def file_browser_field(name, options = {})
prompt = options.delete(:prompt) || "Select #{name.to_s.titleize}"
value = object.send(name)
options[:value] = File.basename(value) if value
- 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"