Showing 1,556 of 1,556 total issues
Assignment Branch Condition size for generate_view_files is too high. [35.69/15] Open
def generate_view_files
@toggle_attrs = set_toggle_attrs
@form_attrs = set_form_attrs
@association_names = @@association_names
@attachments = @@attachments
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for fae_pulldown is too high. [34.21/15] Open
def fae_pulldown(f, attribute, options={})
raise "Fae::MissingRequiredOption: fae_pulldown requires a 'collection' when using it on an ActiveRecord attribute." if !options.has_key?(:collection) && f.object.attribute_names.include?(attribute.to_s)
raise "Fae::ImproperOptionValue: The value #{options[:size]} is not a valid option for 'size'. Please use 'short' or 'long'." if options[:size].present? && ['short','long'].include?(options[:size]) == false
raise "Fae::ImproperOptionValue: The value #{options[:search]} is not a valid option for 'search'. Please use a Boolean." if options[:search].present? && !!options[:search] != options[:search]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [29/10] 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
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for generate_view_files is too high. [34.53/15] Open
def generate_view_files
@toggle_attrs = set_toggle_attrs
@form_attrs = set_form_attrs
@association_names = @@association_names
@attachments = @@attachments
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for generate_view_files is too high. [33.06/15] Open
def generate_view_files
@form_attrs = set_form_attrs
@attachments = @@attachments
template "views/table_nested.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/table.html.#{options.template}"
template "views/_form_nested.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/_form.html.#{options.template}"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for set_globals is too high. [33.79/15] 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
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for label_and_hint is too high. [31.7/15] 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
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for update is too high. [30.43/15] Open
def update
authorize_role
params[:user].delete(:password) if params[:user][:password].blank?
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [24/10] Open
def post(endpoint, params = nil)
begin
uri = URI.parse(endpoint)
request = Net::HTTP::Post.new(uri)
set_headers(request)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for change is too high. [29/15] Open
def change
create_table(:fae_users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [24/10] 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
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
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
Assignment Branch Condition size for post is too high. [27.75/15] Open
def post(endpoint, params = nil)
begin
uri = URI.parse(endpoint)
request = Net::HTTP::Post.new(uri)
set_headers(request)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [22/10] Open
def inject_model_attachments
return if @@attachments.blank?
@@attachments.each do |attachment|
if attachment.type == :image
inject_into_file "app/models/#{file_name}.rb", after: "include Fae::BaseModelConcern\n" do
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for filter is too high. [17/6] 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
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [21/10] 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
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [21/10] Open
def get(endpoint)
begin
uri = URI.parse(endpoint)
request = Net::HTTP::Get.new(uri)
set_headers(request)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for fae_filter_select is too high. [25.67/15] Open
def fae_filter_select(attribute, opts = {})
options = prepare_options_for_filter_select(attribute, opts)
# grouped_by takes priority over grouped_options
if options[:grouped_by].present?
select_options = filter_generate_select_group(options[:collection], options[:grouped_by], options[:label_method])
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for fae_grouped_select is too high. [25.02/15] Open
def fae_grouped_select(f, attribute, options={})
raise "Fae::MissingRequiredOption: fae_grouped_select requires a `collection` option or `groups` and `labels` options." if !options.has_key?(:collection) && !options.has_key?(:groups) && !options.has_key?(:labels)
raise "Fae::MissingRequiredOption: fae_grouped_select required a `labels` option with a value containing an array when using the `groups` option." if options[:groups].present? && options[:labels].blank?
raise "Fae::MissingRequiredOption: fae_grouped_select required a `groups` option with a value containing an array when using the `labels` option." if options[:labels].present? && options[:groups].blank?
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for validate_each is too high. [25.96/15] 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
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric