artirix/browsercms

View on GitHub

Showing 87 of 119 total issues

Method user_class_devise_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def user_class_devise_options
      Rails.application.config.cms.user_class_devise_options.dup.tap do |opts|
        if devise_use_cas_only?
          opts.delete :database_authenticatable
          opts.delete :rememberable
Severity: Minor
Found in lib/cms/configuration.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 add_inline_content_route has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_inline_content_route(base_route_name, klass)
    denamespaced_controller = klass.name.demodulize.pluralize.underscore
    module_name             = klass.name.deconstantize.underscore
    inline_route_name       = "#{base_route_name}_inline"
    unless route_exists?(inline_route_name)
Severity: Minor
Found in lib/cms/route_extensions.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 visible? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def visible?
    return false unless node
    return false if (node.respond_to?(:hidden?) && node.hidden?)
    return false if (node.respond_to?(:archived?) && node.archived?)
    return false if (node.respond_to?(:published?) && !node.published?)
Severity: Minor
Found in app/models/cms/section_node.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 remove_connector has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def remove_connector(connector)
    transaction do
      raise "Connector is nil" unless connector
      update_attributes(version_comment: "#{connector.connectable} was removed from the '#{connector.container}' container", publish_on_save: false)

Severity: Minor
Found in app/models/cms/page.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 button_menu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def button_menu(location)
      container_class = location == :top ? 'span6 top-buttons' : 'form-actions clearfix'
      container_element = location == :top ? 'span' : 'div'
      content_tag container_element, class: container_class do
        yield if block_given?
Severity: Minor
Found in app/helpers/cms/ui_elements_helper.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 do_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def do_command(result)
      load_block
      if yield
        flash[:notice] = "#{content_type_name.demodulize.titleize} '#{@block.name}' was #{result}" unless request.xhr?
      else
Severity: Minor
Found in app/controllers/cms/content_block_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 able_to_view? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def able_to_view?(object)
            section = object
            if object.is_a?(String)
              section = Cms::Section.find_by_path(object)
              raise ActiveRecord::RecordNotFound.new("Could not find section with path = '#{object}'") unless section
Severity: Minor
Found in lib/cms/acts/cms_user.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