gitlabhq/gitlabhq

View on GitHub
app/presenters/merge_request_presenter.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class MergeRequestPresenter has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
  include ActionView::Helpers::UrlHelper
  include GitlabRoutingHelper
  include MarkupHelper
  include TreeHelper
Severity: Minor
Found in app/presenters/merge_request_presenter.rb - About 4 hrs to fix

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

      def ci_status
        if pipeline
          status = pipeline.status
          status = "success-with-warnings" if pipeline.success? && pipeline.has_warnings?
    
    
    Severity: Minor
    Found in app/presenters/merge_request_presenter.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 source_branch_with_namespace_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def source_branch_with_namespace_link
        namespace = source_project_namespace
        branch = source_branch
    
        namespace_link = source_branch_exists? ? link_to(namespace, project_path(source_project)) : ERB::Util.html_escape(namespace)
    Severity: Minor
    Found in app/presenters/merge_request_presenter.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