Showing 91 of 169 total issues
Function content
has 172 lines of code (exceeds 25 allowed). Consider refactoring. Open
function content(state = {}, action) {
switch (action.type) {
// EDITOR
case 'EDITOR::LOAD':
Function withEditingSection
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
const withEditingSection = Component => {
const findSetting = (sectionDefinition, blockDefinition, settingId) => {
if (settingId === null || settingId === undefined) return null;
Function withEditingSection
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
const withEditingSection = Component => {
const findSetting = (sectionDefinition, blockDefinition, settingId) => {
if (settingId === null || settingId === undefined) return null;
- 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 _localize
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def _localize(page, locales, default_locale, parent_fullpaths)
slug = page.slug_translations[default_locale]
locales.each do |locale|
next if locale == default_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
Method _definition_schema
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _definition_schema
{
id: 'http://www.locomotive.cms/schemas/sections/definition2.json',
definitions: {
settings: {
Function build
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const build = (pageId, contentEntryId, baseUrl) => {
const _pageId = compact([pageId, contentEntryId]).join('-');
const basePath = `/${_pageId}/content/edit`;
const sectionsPath = `${basePath}/sections`;
Method call
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
disable_live_editing_if_not_html(env)
status, headers, response = @app.call(env)
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { setting, getValue, label, handleChange } = this.props;
const value = getValue(null);
const image = value && typeof(value) === 'object' ? value : { source: value };
Method update_all
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_all(list_of_attributes)
[].tap do |elements|
pages, modified_pages = {}, {}
list_of_attributes.each do |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"
Further reading
Function withApiFetching
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const withApiFetching = (source, options) => (Component) => {
const _options = Object.assign({ pagination: false }, options);
return class WithFetching extends React.Component {
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<View
title={i18n.t('views.pickers.assets.title')}
subTitle={this.props.blockLabel || this.props.sectionLabel}
Function editor
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function editor(state = {}, action) {
switch(action.type) {
case 'EDITOR::LOAD':
return action.editor;
Method with_flash_message
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def with_flash_message(type = :notice, in_header = true)
unless set_flash_message?
yield if block_given?
return
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
Function render
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<View
title={i18n.t('views.pickers.images.title')}
subTitle={this.props.blockLabel || this.props.sectionLabel}
Function render
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { sectionDefinition, sectionContent, translate } = this.props;
// DEBUG
// console.log('BlockList', sectionDefinition.blocks_display, sectionDefinition.block_max_depth, sectionDefinition.blocks_display === 'tree' ? sectionDefinition.block_max_depth || 1 : 0)
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
config: { options, link, unlink, className },
currentState,
expanded,
Method authenticate!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
resource = valid_password? && mapping.to.find_for_database_authentication(authentication_hash)
encrypted = false
return fail(:invalid) unless 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 sections_content
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def sections_content(model, sections, definitions)
source = model.respond_to?(:title) ? :page : :site
content = model.sections_content || {}
(sections[:top] + sections[:bottom]).each do |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"
Further reading
Method render_exception
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_exception(exception)
::Locomotive.log "[ApplicationError] #{exception.inspect}"
status = (case exception
when ::Mongoid::Errors::DocumentNotFound then 404
- 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 update_select_options
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_select_options(options)
return nil if options.blank?
default_locale = field._parent.site.default_locale.to_sym
include_new_options = false
- 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"