Showing 72 of 107 total issues
File widgets.js
has 506 lines of code (exceeds 250 allowed). Consider refactoring. Open
import jQuery from "jquery";
import "jquery-ui/ui/widgets/sortable.js";
import * as bootstrap from "bootstrap";
import flatpickr from "flatpickr";
import I18n from "./i18n";
Function append
has 190 lines of code (exceeds 25 allowed). Consider refactoring. Open
append: function (options) {
var field_label = options["label"];
var field_name = options["name"];
var field_type = options["type"];
var field_value = options["value"] || "";
Method menu_for
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def menu_for(parent, abstract_model = nil, object = nil, only_icon = false)
actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) && a.show_in_menu }
actions.collect do |action|
wording = wording_for(:menu, action)
li_class = ['nav-item', 'icon', "#{action.key}_#{parent}_link"].
- 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 filter-box.js
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
import jQuery from "jquery";
import I18n from "./i18n";
import flatpickr from "flatpickr";
(function ($) {
File filtering-multiselect.js
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
import jQuery from "jquery";
import "jquery-ui/ui/widget.js";
import I18n from "./i18n";
(function ($) {
Function build_operator
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
build_operator: function (operator, options) {
if (operator instanceof Object) {
var element = $("<option></option>");
element.text(operator.label);
delete operator.label;
Function _build
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
_build: function () {
var i;
this.wrapper = this.element.siblings(
'.ra-multiselect[data-input-for="' + this.element.attr("id") + '"]'
File active_record.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_record'
require 'rails_admin/adapters/active_record/association'
require 'rails_admin/adapters/active_record/object_extension'
require 'rails_admin/adapters/active_record/property'
Method build_statement_for_integer_decimal_or_float
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def build_statement_for_integer_decimal_or_float
case @value
when Array
val, range_begin, range_end = *@value.collect do |v|
next unless v.to_i.to_s == v || v.to_f.to_s == 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
File base.rb
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_admin/config/proxyable'
require 'rails_admin/config/configurable'
require 'rails_admin/config/hideable'
require 'rails_admin/config/groupable'
require 'rails_admin/config/inspectable'
Function _bindFormEvents
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
_bindFormEvents: function () {
var widget = this,
dialog = this._getModal(),
form = dialog.find("form"),
saveButtonText = dialog.find(":submit[name=_save]").html(),
Method all
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def all(options = {}, scope = nil)
scope ||= scoped
scope = scope.includes(*options[:include]) if options[:include]
scope = scope.limit(options[:limit]) if options[:limit]
scope = scope.any_in(_id: options[:bulk_ids]) if options[:bulk_ids]
- 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 Association
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Association
attr_reader :association, :model
delegate :autosave?, to: :association
Class Base
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Base # rubocop:disable Metrics/ClassLength
include RailsAdmin::Config::Proxyable
include RailsAdmin::Config::Configurable
include RailsAdmin::Config::Hideable
include RailsAdmin::Config::Groupable
File filtering-select.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import jQuery from "jquery";
import "jquery-ui/ui/widget.js";
import "jquery-ui/ui/widgets/autocomplete.js";
import I18n from "./i18n";
Function _initAutocomplete
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initAutocomplete: function () {
var self = this;
return this.input.autocomplete({
delay: this.options.searchDelay,
Class AbstractModel
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractModel
cattr_accessor :all
attr_reader :adapter, :model_name
class << self
File mongoid.rb
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mongoid'
require 'rails_admin/config/sections/list'
require 'rails_admin/adapters/mongoid/association'
require 'rails_admin/adapters/mongoid/object_extension'
require 'rails_admin/adapters/mongoid/property'
Method new
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def new(m)
m = m.constantize unless m.is_a?(Class)
(am = old_new(m)).model && am.adapter ? am : nil
rescue *([LoadError, NameError] + (defined?(ActiveRecord) ? ['ActiveRecord::NoDatabaseError'.constantize, 'ActiveRecord::ConnectionNotEstablished'.constantize] : []))
puts "[RailsAdmin] Could not load model #{m}, assuming model is non existing. (#{$ERROR_INFO})" unless Rails.env.test?
- 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 _bindEvents
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_bindEvents: function () {
var widget = this;
/* Add all to selection */
this.addAll.click(function (e) {