gitlabhq/gitlabhq

View on GitHub
app/helpers/issuables_helper.rb

Summary

Maintainability
B
6 hrs
Test Coverage

File issuables_helper.rb has 369 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module IssuablesHelper
  include GitlabRoutingHelper

  def sidebar_gutter_toggle_icon
    sidebar_gutter_collapsed? ? icon('angle-double-left', { 'aria-hidden': 'true' }) : icon('angle-double-right', { 'aria-hidden': 'true' })
Severity: Minor
Found in app/helpers/issuables_helper.rb - About 4 hrs to fix

    Method issuable_initial_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def issuable_initial_data(issuable)
        data = {
          endpoint: issuable_path(issuable),
          updateEndpoint: "#{issuable_path(issuable)}.json",
          canUpdate: can?(current_user, :"update_#{issuable.to_ability_name}", issuable),
    Severity: Minor
    Found in app/helpers/issuables_helper.rb - About 1 hr to fix

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

        def issuable_labels_tooltip(labels, limit: 5)
          first, last = labels.partition.with_index { |_, i| i < limit }
      
          if labels && labels.any?
            label_names = first.collect { |label| label.fetch(:title) }
      Severity: Minor
      Found in app/helpers/issuables_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

      There are no issues that match your filters.

      Category
      Status