Showing 91 of 169 total issues
Method fetch_file
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.fetch_file(source)
file = nil
if source.is_a?(String) || source.is_a?(Hash) # simple string or drop
source = source['url'] if source.is_a?(Hash)
- 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 build_fullpath
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def build_fullpath
if self.index_or_not_found?
self.site.each_locale { |locale, current| self.fullpath = self.slug }
else
_parent = self.parent # do not hit the database more than once
- 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 underscore_keys
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def underscore_keys
new_hash = {}
self.each_pair do |key, value|
if value.respond_to?(:collect!) # Array
- 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_content_type_of_model
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_content_type_of_model(content_type)
value = :other
self.class.content_types.each_pair do |type, rules|
rules.each do |rule|
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { pageId, iframeLoaded, location } = this.props;
const currentKey = iframeLoaded ? location.pathname : 'startup';
const slideDirection = !iframeLoaded ? 'up' : (location.state || {}).slideDirection || 'up';
const timeout = slideDirection === 'none' ? { enter: 1, exit: 1 } : { enter: 150, exit: 100 };
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { sectionDefinition } = this.props;
return (
<div className="editor-section-blocks--new" ref={el => this.pickerRef = el}>
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { setting, getValue, label, handleChange } = this.props;
const value = getValue(null);
const asset = value && typeof(value) === 'object' ? value : { url: value };
Method _metafields_schema_schema
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _metafields_schema_schema
{
'id' => 'http://locomotive.works/schemas/metafields.json',
'definitions' => {
'field' => {
Method to_json
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_json
add_authenticated_header
if get?
add_pagination_header if resource.respond_to?(:total_pages)
Function build
has a Cognitive Complexity of 10 (exceeds 5 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`;
- 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 attributes=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def attributes=(values)
return unless values
@_attributes = values # memoize them for the callbacks
- 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 document_stamp
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def document_stamp(document)
distance = distance_of_time_in_words_to_now(document.updated_at)
update = document.updated_at && document.updated_at != document.created_at
if account = (document.updated_by || document.created_by)
- 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 as_json
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def as_json(methods = nil)
methods ||= self.getters
{}.tap do |hash|
methods.each do |meth|
_options = self.property_options[meth]
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const TabPane = {
sections: Sections,
settings: Settings,
seo: Seo
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { input, suggestions, loading } = this.state;
const inputProps = {
placeholder: this.props.placeholder,
value: input || '',
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { input, suggestions, loading } = this.state;
const inputProps = {
placeholder: this.props.placeholder,
value: input || '',
Method set_slug
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_slug
self._slug = self._label.dup if self._slug.blank? && self._label.present?
if self._slug.present?
# we can't rely on the self.site property yet (brand new entry for instance)
- 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_all
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_all(attributes)
each_metafield(attributes) do |namespace, name, value|
next unless field = site.find_metafield(name)
if field['localized']
- 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 current_site_url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def current_site_url
if current_site.domains.blank?
preview_url(current_site)
else
protocol = current_site.redirect_to_https? ? 'https' : 'http'
- 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 to_json
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_json
add_authenticated_header
if get?
add_pagination_header if resource.respond_to?(:total_pages)
- 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"