gregbell/active_admin

View on GitHub

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;

Severity: Major
Found in plugin.js - About 1 day to fix

    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.
        #
    Severity: Minor
    Found in app/controllers/active_admin/resource_controller/data_access.rb - About 4 hrs to fix

      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
      
      
      Severity: Minor
      Found in lib/active_admin/resource.rb - About 3 hrs to fix

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

          Class Application has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Application
          
              class << self
                def setting(name, default)
                  ApplicationSettings.register name, default
          Severity: Minor
          Found in lib/active_admin/application.rb - About 2 hrs to fix

            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]
            
            
            Severity: Minor
            Found in app/helpers/active_admin/breadcrumb_helper.rb - About 1 hr to fix

            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)
            Severity: Minor
            Found in lib/active_admin/views/components/paginated_collection.rb - About 1 hr to fix

            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|
            Severity: Minor
            Found in app/helpers/active_admin/form_helper.rb - About 1 hr to fix

            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)
            
            
            Severity: Minor
            Found in app/helpers/active_admin/form_helper.rb - About 1 hr to fix

            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)
            Severity: Minor
            Found in lib/active_admin/views/components/paginated_collection.rb - About 1 hr to fix

              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|
              Severity: Minor
              Found in lib/active_admin/views/index_as_table.rb - About 1 hr to fix

              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
              Severity: Minor
              Found in lib/active_admin/scope.rb - About 1 hr to fix

              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
              Severity: Minor
              Found in tasks/test_application.rb - About 1 hr to fix

                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
                Severity: Minor
                Found in lib/active_admin/views/components/active_admin_form.rb - About 55 mins to fix

                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
                Severity: Minor
                Found in app/helpers/active_admin/display_helper.rb - About 55 mins to fix

                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
                Severity: Minor
                Found in lib/active_admin/views/components/status_tag.rb - About 45 mins to fix

                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
                Severity: Minor
                Found in lib/active_admin/views/components/paginated_collection.rb - About 45 mins to fix

                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]
                Severity: Minor
                Found in app/controllers/active_admin/resource_controller.rb - About 35 mins to fix

                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"
                Severity: Minor
                Found in lib/active_admin/form_builder.rb - About 35 mins to fix

                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 = {
                Severity: Minor
                Found in lib/active_admin/views/components/table_for.rb - About 35 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language