wearefine/fae

View on GitHub

Showing 1,556 of 1,556 total issues

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)
Severity: Minor
Found in lib/generators/fae/base_generator.rb - About 2 hrs to fix

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)
 
 
Severity: Minor
Found in lib/file_size_validator.rb - About 2 hrs to fix

Perceived complexity for filter is too high. [16/7]
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?
Severity: Minor
Found in app/models/fae/change.rb by rubocop

Method has too many lines. [19/10]
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)

Assignment Branch Condition size for get is too high. [24.66/15]
Open

def get(endpoint)
begin
uri = URI.parse(endpoint)
request = Net::HTTP::Get.new(uri)
set_headers(request)
Severity: Minor
Found in app/services/fae/netlify_api.rb by rubocop

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';
Severity: Major
Found in app/assets/javascripts/fae/form/inputs/_select.js - About 2 hrs to fix

    Assignment Branch Condition size for update_parent is too high. [23.96/15]
    Open

    def update_parent
    parent = self.try(:imageable) || self.try(:fileable) || self.try(:contentable)
    if parent.present?
    latest_change = parent.try(:tracked_changes).try(:first)
    if latest_change.present? && latest_change.change_type == 'updated' && latest_change.updated_at > 2.seconds.ago

    Assignment Branch Condition size for clone_has_many_relationships is too high. [23.22/15]
    Open

    def clone_has_many_relationships(association)
    if @item.send(association).present?
    @item.send(association).reverse.each do |record|
    new_record = association.to_s.classify.constantize.find_by_id(record.id).dup
    new_record.send("#{@klass_singular}_id" + '=', @cloned_item.id) if new_record.send("#{@klass_singular}_id").present?

    Method has too many lines. [17/10]
    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
    Severity: Minor
    Found in app/models/fae/static_page.rb by rubocop

    Assignment Branch Condition size for setup_dynamic_singleton is too high. [22.2/15]
    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
    Severity: Minor
    Found in app/models/fae/static_page.rb by rubocop

    Assignment Branch Condition size for fae_filter_form is too high. [22.41/15]
    Open

    def fae_filter_form(options = {}, &block)
    options = prepare_options_for_filter_form options
    return if options[:collection].blank?
     
    form_tag(options[:action], prepare_form_filter_hash(options)) do
    Severity: Minor
    Found in app/helpers/fae/view_helper.rb by rubocop

    Method has too many lines. [17/10]
    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)
     
     
    Severity: Minor
    Found in lib/file_size_validator.rb by rubocop

    Method has too many lines. [16/10]
    Open

    def update_parent
    parent = self.try(:imageable) || self.try(:fileable) || self.try(:contentable)
    if parent.present?
    latest_change = parent.try(:tracked_changes).try(:first)
    if latest_change.present? && latest_change.change_type == 'updated' && latest_change.updated_at > 2.seconds.ago

    Method has too many lines. [16/10]
    Open

    def td_columns(params)
    attribute = params[:col]
    attributes = params[:cols]
    item = params[:item]
     
     

    Assignment Branch Condition size for update is too high. [21.31/15]
    Open

    def update
    if params[:form_manager].present?
    fields_serialized = params[:form_manager][:fields].to_json
    conditions = {
    form_manager_model_name: params[:form_manager][:form_manager_model_name],

    Assignment Branch Condition size for authorize_model is too high. [21.1/15]
    Open

    def authorize_model(model)
    return false if current_user.blank? || current_user.role.blank? || current_user.role.name.blank?
     
    users_role = current_user.role.name.downcase
    tableized_model = model.name.tableize

    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');
    Severity: Minor
    Found in app/assets/javascripts/fae/form/_form_manager.js - About 2 hrs to fix

    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
    Severity: Minor
    Found in app/controllers/concerns/fae/cloneable.rb - About 2 hrs to fix

    Method has too many lines. [15/10]
    Open

    def add_update_change
    if has_parent?
    update_parent
    else
    return if legit_updated_attributes.blank?

    Cyclomatic complexity for label_and_hint is too high. [11/6]
    Open

    def label_and_hint(attribute, options)
    hint = options[:hint]
     
    options[:helper_text] = attempt_common_helper_text(attribute) if options[:helper_text].blank?
     
     
    Severity: Minor
    Found in app/helpers/fae/form_helper.rb by rubocop
    Severity
    Category
    Status
    Source
    Language