Showing 85 of 96 total issues
Class BaseController
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseController < ApplicationController
include Avo::Concerns::FiltersSessionHandler
before_action :set_resource_name
before_action :set_resource
File base_controller.rb
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_dependency "avo/application_controller"
module Avo
class BaseController < ApplicationController
include Avo::Concerns::FiltersSessionHandler
Class ResourceGenerator
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class ResourceGenerator < NamedBaseGenerator
include Concerns::ParentController
include Concerns::OverrideController
source_root File.expand_path("templates", __dir__)
Method visible_items
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def visible_items
items
.map do |item|
hydrate_item item
- 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
Class BaseField
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseField
extend ActiveSupport::DescendantsTracker
prepend Avo::Concerns::HasItemType
prepend Avo::Concerns::IsResourceItem
Method eject_component
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def eject_component(component_to_eject = options[:component], confirmation: true)
# Underscore the component name
# Example: Avo::Views::ResourceIndexComponent => avo/views/resource_index_component
component = component_to_eject.underscore
- 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
File resource_generator.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "named_base_generator"
require_relative "concerns/parent_controller"
require_relative "concerns/override_controller"
module Generators
Class ResourceComponent
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Avo::ResourceComponent < Avo::BaseComponent
include Avo::Concerns::ChecksAssocAuthorization
include Avo::Concerns::RequestMethods
attr_reader :fields_by_panel
Method unwrap
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def unwrap(i, level = 0, view: :show)
result = []
i.items.each do |item|
label = ""
- 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 only_fields
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def only_fields(only_root: false)
fields = []
items.each do |item|
next if item.nil?
- 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
Class ResourceIndexComponent
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
include Avo::ResourcesHelper
include Avo::ApplicationHelper
attr_reader :scopes, :query, :turbo_frame, :parent_record, :parent_resource, :resource, :actions
Function addSource
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
addSource(resourceName, data) {
const that = this
return {
sourceId: resourceName,
Class BaseAction
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseAction
include Avo::Concerns::HasItems
include Avo::Concerns::HasActionStimulusControllers
class_attribute :name, default: nil
Method initialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def initialize(id, **args, &block)
super(id, **args, &block)
hide_on :index
- 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 create_files
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_files
unless tailwindcss_installed?
say "Installing Tailwindcss"
system "./bin/bundle add tailwindcss-rails"
system "./bin/rails tailwindcss:install"
Method initialize_views
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def initialize_views
# Set defaults
@show_on_index = @show_on_index.nil? ? true : @show_on_index
@show_on_show = @show_on_show.nil? ? true : @show_on_show
@show_on_new = @show_on_new.nil? ? true : @show_on_new
- 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 eject_partial
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def eject_partial
if options[:partial].starts_with?(":")
template_id = path_to_sym options[:partial]
template_path = TEMPLATES[template_id]
- 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 item
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
item({ item, createElement }) {
const children = []
if (item._avatar) {
let classes
Function initEdit
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
initEdit() {
const options = {
enableTime: false,
enableSeconds: false,
// eslint-disable-next-line camelcase
Method initialize
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@root_path = "/avo"
@app_name = ::Rails.application.class.to_s.split("::").first.underscore.humanize(keep_id_suffix: true)
@timezone = "UTC"
@per_page = 24