Showing 11 of 37 total issues
Function exports
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Method section_heading
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def section_heading(heading:, extra: nil, spacing: :hr, count: nil, icon: nil)
out = ActiveSupport::SafeBuffer.new
if spacing == :hr
out << content_tag(:div, class: "grid-x") do
content_tag(:div, class: "cell auto") 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
Method create_fields
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_fields(mailtrain_list_id)
MailtrainService.instance.create_field(
mailtrain_list_id,
{
"NAME": "Postcode",
Method section_heading
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def section_heading(heading:, extra: nil, spacing: :hr, count: nil, icon: nil)
out = ActiveSupport::SafeBuffer.new
if spacing == :hr
out << content_tag(:div, class: "grid-x") do
content_tag(:div, class: "cell auto") do
Method rebel_params
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rebel_params(params)
params
.require(:rebel)
.permit(
:agree_with_principles,
Method decorate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decorate(model, cache: false, reload: true)
if model.present?
base = model.class.name.underscore.gsub("/", "__")
decorator_class = "#{model.class.name}Decorator".constantize
decorator_var = "@#{base}_decorator"
- 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 callout
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def callout(type, content:, tiny: false, link_label: nil, link_href: nil, link_options: {})
out = ActiveSupport::SafeBuffer.new
if link_label && link_href
out << content_tag(:div, class: "cell small-12 medium-shrink") do
if tiny
- 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 animateCss
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
animateCss(node, animationName, callback) {
node.classList.add('animated')
if (animationName instanceof Array) {
animationName.forEach((animationClass, i) => {
node.classList.add(animationClass)
- 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_menu_items
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_menu_items(menu_items, level, options = {})
if menu_items.present?
ul_options = { class: ['menu', options[:class]] }
if options[:dropdown]
ul_options[:class] << 'dropdown'
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
service = Rebels::ImportService.new
if service.run(params)
@csv_import = service.csv_import
if !@csv_import.import_errors.any?
- 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 catch_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def catch_error(context: {})
block_given? ? yield : false
rescue => e
Raven.capture_exception(e) if report_errors?
Rails.logger.debug("#{e.class.name} - #{e.message}")
- 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"