moneyadviceservice/frontend

View on GitHub

Showing 24 of 43 total issues

Function iframeResizer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

window.iframeResizer = function(msgPrefix, targetOrigin, minFrameHeight) {
  'use strict';

  var timer, frameDefaultOverflow;

Severity: Minor
Found in app/assets/javascripts/syndication/iframeResizer.js - About 25 mins to fix

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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def process(*xpaths)
      doc.xpath(*xpaths).each do |node|
        node.parent.name == 'p' ? swap_node(node.parent) : swap_node(node)
        node.set_attribute('title', 'Video') unless node.attribute('title')
      end
Severity: Minor
Found in lib/html_processor/video_wrapper.rb - About 25 mins to fix

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 not_implemented has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def not_implemented
    return head :not_found if Rails.env.development?

    interactor.call do |error|
      return redirect_to error.location, status: error.status if error.redirect?
Severity: Minor
Found in app/controllers/catchall_controller.rb - About 25 mins to fix

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 validate_each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_each(record, attribute, value)
      if value.blank?
        record.errors.add(attribute, :blank, value: value)
      elsif invalid_format?(value)
        record.errors.add(attribute, :invalid, value: value)
Severity: Minor
Found in lib/validators/email.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language