Showing 91 of 169 total issues
Function signalExpandShowModal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
signalExpandShowModal() {
const { onExpandEvent, currentState: { link, selectionText } } = this.props;
const { linkTargetOption } = this.state;
onExpandEvent();
this.setState({
- 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 ensure_target_klass_name_security
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_target_klass_name_security
return if !self.templatized? || self.target_klass_name.blank?
if self.target_klass_name =~ /^Locomotive::ContentEntry([a-z0-9]+)$/
content_type = Locomotive::ContentType.find($1)
- 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 remove!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remove!
record.class.uploaders.each do |_column, _|
next if _column == column
_mounter = self.record.send(:_mounter, _column)
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const withApiFetching = (source, options) => (Component) => {
const _options = Object.assign({ pagination: false }, options);
return class WithFetching extends React.Component {
- 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 sync_relationships_order_by_for_belongs_to_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sync_relationships_order_by_for_belongs_to_fields
current_class_name = self.klass_with_custom_fields(:entries).name
self.entries_custom_fields.where(type: 'belongs_to').each do |field|
target_content_type = self.class_name_to_content_type(field.class_name)
- 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 find_layout
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_layout
return if !self.allow_layout? || self.layout_id
if self.raw_template =~ EXTENDS_FULLPATH_REGEX
# first in the current 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 persist_editable_elements!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def persist_editable_elements!(page, parsed)
modified_pages, pages = [], { page._id => page } # group modifications by page
parsed[:elements].map! do |couple|
_page, attributes = couple
- 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 vignette_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def vignette_url
if self.image?
# In some case (like an invalid extension) the height, width can be nill
# In that case we should directly return the url
if self.width && self.height && self.width < 85 && self.height < 85
- 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 prepare_options_for_all
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_options_for_all(options)
{ where: prepare_where_statement(options) }.tap do |_options|
unless options[:no_pagination]
_options[:page] = options[:page] || 1
_options[:per_page] = options[:per_page] || Locomotive.config.ui[:per_page]
- 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 bulk_create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def bulk_create(list)
list = list.values if list.is_a?(Hash)
assets = list.map { |params| create_or_update(params) }
- 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 handle_no_account_or_site
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_no_account_or_site(env, request)
if Locomotive::Account.count == 0
redirect_to((Locomotive.config.enable_registration ? sign_up_path : sign_in_path))
elsif default_host?(request)
redirect_to(sign_in_path)
- 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"