Showing 146 of 242 total issues
Method down
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def down
unless (Product::Recruiting rescue nil)
create_table 'vacancies', force: true do |t|
t.string 'type'
t.integer 'project_id'
Function letWinnerWinMatchesAgainstCompetitorsWhichLoseAgainstLoser
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
CompetitiveList.prototype.letWinnerWinMatchesAgainstCompetitorsWhichLoseAgainstLoser = function(winnerId, loserId) {
var base;
(base = this.defeatedCompetitorsByCompetitor)[loserId] || (base[loserId] = []);
return $.each(this.matches, (function(_this) {
return function(index, match) {
Method update
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
if params[:event] && params[:event].keys.select{|k| ['cancel', 'skip'].include?(k)}.any?
send(params[:event].keys.first)
return
end
Method gem_dependencies
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gem_dependencies
add_source "http://gems.github.com"
# core
gem 'rack-cors', '~> 0.2.4', require: 'rack/cors'
Method eager_load_polymorphs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def eager_load_polymorphs(list, includes)
polymorphs = {}
logger.debug "eager_load_polymorphs for list length: #{list.length}"
- 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_or_create_by_params
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.find_or_create_by_params(params)
attributes = (params[:user_list_item] || params[:list_item] || params).clone
attributes.symbolize_keys! unless params.is_a?(ActiveSupport::HashWithIndifferentAccess)
if attributes[:list_id].present? then List.find(attributes[:list_id])
- 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 wizard_steps
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def wizard_steps(*wizard_steps)
const_set 'WIZARD_STEPS', wizard_steps
# TODO: clarify if we still need to generate actions when we have an update action and next_step trigger
"::#{self.to_s}::WIZARD_STEPS".constantize.each do |wizard_step|
- 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 sortByMostWins
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
CompetitiveList.prototype.sortByMostWins = function(after_update_request_proc) {
var $wrapper, data, positions, winsByCompetitor;
if (after_update_request_proc == null) {
after_update_request_proc = null;
}
Method create_from_table
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_from_table(model_name, table, extra = {})
factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
is_singular = model_name.to_s.singularize == model_name.to_s
hashes = if is_singular
Method path_to
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def path_to(page_name)
case page_name
when /^the home\s?page$/
'/'
Method path_to
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def path_to(page_name)
case page_name
when /^the home\s?page$/
'/'
Method create_from_table
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_from_table(model_name, table, extra = {})
factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
is_singular = model_name.to_s.singularize == model_name.to_s
hashes = if is_singular
Method create_from_table
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_from_table(model_name, table, extra = {})
factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
is_singular = model_name.to_s.singularize == model_name.to_s
hashes = if is_singular
Method render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def render(item_container)
content, first_item_selected = '', false
item_container.items.each do |item|
next if [
- 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 letOutMatchedCompetitorsOfWinnerWinAgainstLoser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
CompetitiveList.prototype.letOutMatchedCompetitorsOfWinnerWinAgainstLoser = function(winnerId, loserId) {
var base;
(base = this.outmatchedCompetitorsByCompetitor)[winnerId] || (base[winnerId] = []);
return $.each(this.outmatchedCompetitorsByCompetitor[winnerId], (function(_this) {
return function(index, competitorId) {
Function buildFormatTokens
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildFormatTokens() {
createPaddedToken('f', function(d) {
return callDateGet(d, 'Milliseconds');
}, true);
Method table_cell
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def table_cell column, resource, alternative_value = nil
value = '-'
if column == 'name'
value = resource.send(column)
Function createLazyFunction
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createLazyFunction(fn, ms, immediate, limit) {
var queue = [], locked = false, execute, rounded, perExecution, result;
ms = ms || 1;
limit = limit || Infinity;
rounded = ceil(ms);
Function sort
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
options.sort = function(event, ui) {
var parent = ui.item.parent(),
myIndex = ui.item.data('i'),
top = parseInt(ui.item.css('top').replace('px', '')),
left = parseInt(ui.item.css('left').replace('px', ''));
Method initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user, options = {})
controller_namespace = options[:controller_namespace] || ""
project = options[:project] || nil
alias_action :index, :show, :autocomplete, :parents, :childs, :tree, to: :read