Showing 52 of 73 total issues
Method crudify
has 222 lines of code (exceeds 25 allowed). Consider refactoring. Open
def crudify(model_name, options = {})
options = ::Refinery::Crud.default_options(model_name).merge(options)
class_name = options[:class_name]
singular_name = options[:singular_name]
plural_name = options[:plural_name]
Function create_sortable_list
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
var create_sortable_list = function(options){
ordered_list = {
initialised: false
, init: function(options) {
if(!this.initialised){
- 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 create_sortable_list
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
var create_sortable_list = function(options){
ordered_list = {
initialised: false
, init: function(options) {
if(!this.initialised){
Class Page
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Page < Core::BaseModel
extend Mobility
translates :title, :menu_title, :custom_slug, :slug, :browser_title, :meta_description
after_save { translations.in_locale(Mobility.locale).seo_meta.save! }
File extension_generation.rb
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Refinery
module ExtensionGeneration
def self.included(base)
base.class_eval do
Function _mouseDrag
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
_mouseDrag: function(event) {
//Compute the helpers position
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");
File nestedsortables.js
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* jQuery UI Nested Sortable
* v 1.3.5 / 21 jun 2012
* http://mjsarfatti.com/code/nestedSortable
*
Class CmsGenerator
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class CmsGenerator < Rails::Generators::Base
source_root Pathname.new(File.expand_path('../templates', __FILE__))
class_option :update, :type => :boolean, :aliases => nil, :group => :runtime,
:desc => "Update an existing Refinery CMS based application"
Function onload
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.onload = function () {
'use strict';
const image = document.getElementById('crop');
const ratios = document.getElementById('ratios');
Method configure!
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def configure!(extension)
::ActiveRecord::Base.extend ::Dragonfly::Model
::ActiveRecord::Base.extend ::Dragonfly::Model::Validations
::Dragonfly.app(extension.dragonfly_name).configure do
- 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 crud.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Refinery
module Crud
def self.default_options(model_name)
class_name = "#{model_name.to_s.camelize.gsub('/', '::')}".gsub('::::', '::')
File cms_generator.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pathname'
require 'mkmf'
module Refinery
class CmsGenerator < Rails::Generators::Base
Method create
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create
@images = []
begin
if params[:image].present? && params[:image][:image].is_a?(Array)
params[:image][:image].each do |image|
- 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 change
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
create_table :refinery_page_parts do |t|
t.integer :refinery_page_id
t.string :title
t.text :body
Method configure!
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure!(extension)
::ActiveRecord::Base.extend ::Dragonfly::Model
::ActiveRecord::Base.extend ::Dragonfly::Model::Validations
::Dragonfly.app(extension.dragonfly_name).configure do
Method update
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update
@image.attributes = image_params
if @image.valid? && @image.save
flash.notice = t('refinery.crudify.updated', what: "'#{@image.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 link_to
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def link_to
# Get the switch_local variable to determine the locale we're currently editing
# Set up Mobility with our current locale
Mobility.locale = if params[:switch_locale].present? && Refinery::I18n.built_in_locales.keys.map(&:to_s).include?(params[:switch_locale])
Mobility.locale = params[:switch_locale]
- 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 toArray
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
toArray: function(options) {
var o = $.extend({}, this.options, options),
sDepth = o.startDepthCount || 0,
ret = [],
Function serializelist
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.serializelist = function(options) {
var defaults = {
attributes: ['id'],
allow_nest: true,
prepend: 'ul',
Function init
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
, init: function(options) {
if(!this.initialised){
this.update_url = options.update_url;
this.sortable_list = $(options.sortable_list);
this.tree = options.tree;