gitlabhq/gitlabhq

View on GitHub
lib/gitlab/ee_compat_check.rb

Summary

Maintainability
C
1 day
Test Coverage

Class EeCompatCheck has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

  class EeCompatCheck
    CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'.freeze
    CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'.freeze
    CHECK_DIR = Rails.root.join('ee_compat_check')
    IGNORED_FILES_REGEX = /VERSION|CHANGELOG\.md/i.freeze
Severity: Minor
Found in lib/gitlab/ee_compat_check.rb - About 4 hrs to fix

    File ee_compat_check.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Gitlab
      # Checks if a set of migrations requires downtime or not.
      class EeCompatCheck
        CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'.freeze
        CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'.freeze
    Severity: Minor
    Found in lib/gitlab/ee_compat_check.rb - About 3 hrs to fix

      Method check_patch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_patch(patch_path)
            step("Checking out master", %w[git checkout master])
            step("Resetting to latest master", %w[git reset --hard canonical-ee/master])
            step(
              "Checking if #{patch_path} applies cleanly to EE/master",
      Severity: Minor
      Found in lib/gitlab/ee_compat_check.rb - About 2 hrs 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 ce_branch_doesnt_apply_cleanly_and_no_ee_branch_msg has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def ce_branch_doesnt_apply_cleanly_and_no_ee_branch_msg
            ee_repos = ee_remotes.values.uniq
      
            %Q{
              #{PLEASE_READ_THIS_BANNER}
      Severity: Minor
      Found in lib/gitlab/ee_compat_check.rb - About 1 hr to fix

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

            def generate_patch(branch:, patch_path:, branch_remote:, master_remote:)
              FileUtils.rm(patch_path, force: true)
        
              find_merge_base_with_master(branch: branch, branch_remote: branch_remote, master_remote: master_remote)
        
        
        Severity: Minor
        Found in lib/gitlab/ee_compat_check.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