Showing 146 of 242 total issues
Method a_tags
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def a_tags(item_container, parent_list = [])
item_container.items.inject([]) do |list, item|
if item.method.blank? && item.selected?
list << tag_for(item) unless parent_list.join('').match(item.url.split('#').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
Function collateStrings
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function collateStrings(a, b) {
var aValue, bValue, aChar, bChar, aEquiv, bEquiv, index = 0, tiebreaker = 0;
var sortIgnore = sugarArray[AlphanumericSortIgnore];
var sortIgnoreCase = sugarArray[AlphanumericSortIgnoreCase];
Method included
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
base.class_eval do
cattr_reader :per_page
@@per_page = 20
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
CompetitiveList.prototype.init = function(el, options) {
this.options = $.extend({}, this.defaults, options);
this.$el = $(el);
this.id = this.$el.attr('id');
$.data(el, this.constructor.prototype.jqueryInstanceMethodName, this);
Function stringify
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stringify(thing, stack) {
var type = typeof thing, isObject, isArrayLike, klass, value, arr, key, i, len;
// Return quickly if string to save cycles
if (type === 'string') return thing;
Function GMapContext
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function GMapContext(domElement, options) {
var _map = new google.maps.Map(domElement, options);
var _marker = new google.maps.Marker({
position: new google.maps.LatLng(54.19335, -3.92695),
map: _map,
Function address_component_from_google_geocode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
address_component_from_google_geocode: function(address_components) {
var result = {};
for (var i = address_components.length-1; i>=0; i--) {
var component = address_components[i];
// Postal code
Method setup_wizard
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def setup_wizard
@step = action_name.try(:to_sym)
unless wizard_steps.include? @step
@step = nil
- 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 matrix
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.matrix(argumentables)
arguments = []
argumentables.each do |index, argumentable|
arguments += Argument.where(
Function mergeObject
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeObject(target, source, deep, resolve) {
// Will not merge a primitive type.
if (!isObjectType(source)) return target;
Function start
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
CompetitiveList.prototype.start = function() {
var matchesAlreadyExist, matchesWithoutWinner;
matchesAlreadyExist = false;
this.matches || (this.matches = []);
if (this.matches.length > 0) {
Function regroup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function regroup(item, list) {
if (list.find('.' + settings.selectedClass).length > 0) {
var myIndex = item.data('i');
var itemsBefore = list.find('.' + settings.selectedClass).filter(function() {
Function compareDate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compareDate(d, find, localeCode, buffer, forceUTC) {
var p, t, min, max, override, accuracy = 0, loBuffer = 0, hiBuffer = 0;
p = getExtendedDate(null, find, localeCode, null, forceUTC);
if (buffer > 0) {
loBuffer = hiBuffer = buffer;
Method comparison
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def comparison
options = {}
arguments = Argument.compare_two_argumentables(params[:argumentable_type], params[:side], params[:left_thing_name], params[:right_thing_name]).
paginate(page: params[:page], per_page: 10)
Method up
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def up
if (Product::Ranking rescue nil)
add_column :arguments, :argumentable_type, :string
add_column :arguments, :argumentable_id, :integer
Method set_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_value(hash, attribute)
value = hash[attribute]
if value.match '@'
if eval(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"
Further reading
Method set_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_value(hash, attribute)
value = hash[attribute]
if value.match '@'
if eval(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"
Further reading
Method next_task_for_user
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def next_task_for_user(user)
return nil if (users_without_tasks_ids || []).include?(user.id)
task = tasks.assigned.not.in(state: ['under_supervision', 'completed']).
where(user_id: user.id).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 step_from_state
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def step_from_state
return false unless wizard_step_per_state.is_a?(Hash)
state = resource.try(:state).try(:to_sym)
- 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_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_value(hash, attribute)
value = hash[attribute]
if value.match '@'
if eval(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"