Showing 30 of 30 total issues
File plugin.js
has 539 lines of code (exceeds 250 allowed). Consider refactoring. Open
const plugin = require('tailwindcss/plugin')
const defaultTheme = require('tailwindcss/defaultTheme');
const colors = require('tailwindcss/colors');
const { spacing, borderWidth, borderRadius } = defaultTheme;
Class ResourceController
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class ResourceController < BaseController
# This module overrides most of the data access methods in Inherited
# Resources to provide Active Admin with it's data.
#
Class Resource
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Resource
# Event dispatched when a new resource is registered
RegisterEvent = "active_admin.resource.register".freeze
Class Namespace
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Namespace
class << self
def setting(name, default)
ActiveAdmin.deprecator.warn "This method does not do anything and will be removed."
end
Class Application
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Application
class << self
def setting(name, default)
ApplicationSettings.register name, default
Method default_breadcrumb_links
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def default_breadcrumb_links(path, html_options = {})
# remove leading "/" and split up the URL
# and remove last since it's used as the page title
parts = path.split("/").select(&:present?)[0..-2]
- 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 page_entries_info
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def page_entries_info(options = {})
if options[:entry_name]
entry_name = options[:entry_name]
entries_name = options[:entries_name] || entry_name.pluralize
elsif collection_empty?(@collection)
- 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 fields_for_params
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def fields_for_params(params, options = {})
namespace = options[:namespace]
except = Array.wrap(options[:except]).map &:to_s
params.flat_map do |k, v|
- 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 active_admin_filters_form_for
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def active_admin_filters_form_for(search, filters, options = {})
defaults = { builder: ActiveAdmin::Filters::FormBuilder, url: collection_path, html: { class: "filters-form" } }
required = { html: { method: :get }, as: :q }
options = defaults.deep_merge(options).deep_merge(required)
- 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 page_entries_info
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def page_entries_info(options = {})
if options[:entry_name]
entry_name = options[:entry_name]
entries_name = options[:entries_name] || entry_name.pluralize
elsif collection_empty?(@collection)
Method actions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def actions(options = {}, &block)
name = options.delete(:name) { "" }
defaults = options.delete(:defaults) { true }
column name, options do |resource|
- 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 initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, method = nil, options = {}, &block)
@name = name
@scope_method = method.try(:to_sym)
if name.is_a? Proc
- 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 generate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate
FileUtils.mkdir_p base_dir
args = %W(
-m spec/support/#{template}.rb
--skip-action-mailbox
Method inputs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def inputs(*args, &block)
if block
form_builder.template.assigns[:has_many_block] = true
end
if block && block.arity == 0
- 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 pretty_format
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pretty_format(object)
case object
when String, Numeric, Symbol, Arbre::Element
object.to_s
when Date, Time
- 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 build
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build(status, options = {})
label = options.delete(:label)
classes = options.delete(:class)
boolean_status = convert_to_boolean_status(status)
status = boolean_status || status
- 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 build_pagination_with_formats
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_pagination_with_formats(options)
div class: "paginated-collection-pagination" do
div page_entries_info(options).html_safe, class: "pagination-information"
build_pagination
end
- 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 page_title
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def page_title
if page_presenter[:title]
case params[:action].to_sym
when :index
case page_presenter[:title]
- 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 has_many_actions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def has_many_actions(form_builder, contents)
if form_builder.object.new_record?
contents << template.content_tag(:li, class: "input") do
remove_text = remove_record.is_a?(String) ? remove_record : I18n.t("active_admin.has_many_remove")
template.link_to remove_text, "#", class: "has-many-remove"
- 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 build_table_header
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_table_header(col)
sort_key = sortable? && col.sortable? && col.sort_key
params = request.query_parameters.except :page, :order, :commit, :format
attributes = {
- 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"