CMDBrew/adminterface

View on GitHub

Showing 11 of 93 total issues

Method build has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def build(item, options = {})
    dropdown = options.delete(:dropdown) { false }

    super(options.merge(id: item.id))
    @label = helpers.render_in_context self, item.label
Severity: Minor
Found in lib/adminterface/extensions/views/components/menu_item.rb - About 1 hr 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 active_admin_filters_form_for has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def active_admin_filters_form_for(search, filters, options = {})
          options = defaults.deep_merge(options).deep_merge(required)

          form_for search, options do |f|
            filters.each do |attribute, opts|
Severity: Minor
Found in lib/adminterface/extensions/filters/forms.rb - About 1 hr 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 build has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def build(menu, options = {})
    dropdown = options.delete(:dropdown) { false }
    menu_class = dropdown ? "dropdown-menu" : ""
    item_class = dropdown ? "dropdown-item" : ""

Severity: Minor
Found in lib/adminterface/extensions/views/components/menu.rb - About 1 hr 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

Function _bind has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _bind () {
    const _self = this
    const dialogEl = this._create()
    const dialogForm = dialogEl.querySelector('#modal-dialog-confirm-form') || {}
    const confirmButton = dialogEl.querySelector('#modal-dialog-confirm-button') || {}
Severity: Minor
Found in app/javascript/adminterface/lib/confirm_dialog.js - About 1 hr to fix

    Method build_comment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def build_comment(comment)
              div for: comment, class: "active_admin_comment #{item_class[:wrapper]}".squish do
                div class: "active_admin_comment_header #{item_class.dig(:header, :wrapper)}".squish do
                  div class: "active_admin_comment_meta #{item_class.dig(:header, :meta)}".squish do
                    div class: "active_admin_comment_author #{item_class.dig(:header, :author)}".squish do

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

      _count () {
        const el = this.element
        const limit = this.options.limit
        let count = 0
        let left = limit
    Severity: Minor
    Found in app/javascript/adminterface/lib/plugins/input_counter.js - About 55 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 to_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_hash
          {kind: allowed_type_names[node_type], name: name}.tap do |hash|
            if namespace
              hash[:nshref] = namespace.href
              hash[:nsprefix] = namespace.prefix
    Severity: Minor
    Found in test/test_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 input_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def input_html
                return super unless grouping?
    
                template.content_tag :div, class: "input-group" do
                  html = []
    Severity: Minor
    Found in lib/adminterface/extensions/inputs/base/groupish.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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def build(namespace, logged_in = true)
        @logged_in = logged_in.eql?(true)
        super(class: "site_title")
        add_class "navbar-brand" if @logged_in
        @namespace = namespace
    Severity: Minor
    Found in lib/adminterface/extensions/views/components/site_title.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 build_per_page_select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def build_per_page_select
                div class: "pagination_per_page" do
                  div class: "input-group input-group-sm" do
                    span I18n.t("active_admin.pagination.per_page"), class: "input-group-text"
    
    
    Severity: Minor
    Found in lib/adminterface/extensions/views/components/paginated_collection.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 build_flash_messages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def build_flash_messages
                return if flash_messages.blank?
    
                div class: "flashes" do
                  flash_messages.each do |type, messages|
    Severity: Minor
    Found in lib/adminterface/extensions/views/pages/base.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