Showing 75 of 1,556 total issues
File _validator.js
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global Fae, judge, FCH */
/**
* Fae form validator
* @namespace form.validator
Method get_deploys_env_response
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_deploys_env_response(path)
return get "#{@endpoint_base}#{path}" unless Rails.env.test?
[
{
"state"=>"building",
Method filter
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def filter(params)
# build conditions if specific params are present
conditions = {}
conditions[:user_id] = params['user'] if params['user'].present?
conditions[:changeable_type] = params['model'] if params['model'].present?
- 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_each
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
- 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_globals
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def set_globals
if attributes.present?
attributes.each do |arg|
# prevent these from being in attributes_flat or attribute_names as they are not real model generator field options
if is_attachment(arg)
- 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 multiselectChosenActions
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
multiselectChosenActions: function() {
var query_input_select = '.input.select';
// Ignore select elements with .multiselect classes, because these are used for a different widget
var query_eligible_multiselects = query_input_select + ' select[multiple]:not(.multiselect)';
var select_all_value = 'multiselect_action-select_all';
Function _setupField
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
_setupField: function($container, overriddenLabel, overriddenHelper) {
var _this = this;
if ($container.length) {
var $label = $container.find('label:first');
var $helperTextContainerEl = $container.find('h6');
- 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 clone_has_one_relationship
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def clone_has_one_relationship(association,type)
old_record = @item.send(association)
if old_record.present?
new_record = old_record.dup
- 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
deploy
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Fae.deploy = {
ready: function() {
if (!$('body').hasClass('deploy')) return false;
this.$deployButtons = $('.js-run-deploy');
Class BaseGenerator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseGenerator < Rails::Generators::NamedBase
source_root ::File.expand_path('../templates', __FILE__)
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
class_option :namespace, type: :string, default: 'admin', desc: 'Sets the namespace of the generator'
class_option :template, type: :string, default: 'slim', desc: 'Sets the template engine of the generator'
Function applyCookies
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
applyCookies: function() {
var cookie_key = $('.js-filter-form').attr('data-cookie-key');
if (cookie_key) {
var cookie = Cookies.getJSON(cookie_key);
- 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 htmlListeners
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
htmlListeners: function() {
$('#js-main-content, .login-form > form, #simplemodal-data')
/**
* For the delete button on file input
File _tables.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global Fae, FCH, Cookies */
/**
* Fae tables
* @namespace tables
Method setup_dynamic_singleton
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.setup_dynamic_singleton
return if @singleton_is_setup
fae_fields.each do |name, value|
type = value.is_a?(Hash) ? value[:type] : 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 change_item_link
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def change_item_link(change)
text = "#{change.changeable_type.gsub('Fae::','')}: "
test_source_method = :data_source_exists?
if change.changeable_type.exclude?('Fae') && change.changeable_type.exclude?('Page') && !ActiveRecord::Base.connection.send(test_source_method, change.changeable_type.tableize)
- 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 initDateRangePicker
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
initDateRangePicker: function() {
$.dateRangePickerLanguages['custom'] = {
'selected': 'Choosed:',
'days': 'Days',
'apply': 'Close',
Function _gatherAndInjectManagerEls
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_gatherAndInjectManagerEls: function() {
$(_this.$theForm.find('['+_this.containerManagerDataId+']')).each(function(i) {
var $container = $(this);
if ($container.hasClass('hidden') || !_this._shouldDisplayInManager($container)) { return; }
Function openAjaxModal
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
openAjaxModal: function (remoteUrl, relatedTarget) {
var _this = this;
$.get(remoteUrl, function (data) {
//Open remote url content in modal window
Function addEditSubmission
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
addEditSubmission: function() {
var _this = this;
this.$addedit_form.on('ajax:success', function(evt, data, status, xhr){
Method label_and_hint
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def label_and_hint(attribute, options)
hint = options[:hint]
options[:helper_text] = attempt_common_helper_text(attribute) if options[:helper_text].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"