gitlabhq/gitlabhq

View on GitHub
app/models/ci/build.rb

Summary

Maintainability
F
3 days
Test Coverage

Class Build has 100 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Build < CommitStatus
    prepend ArtifactMigratable
    include Ci::Processable
    include Ci::Metadatable
    include Ci::Contextable
Severity: Major
Found in app/models/ci/build.rb - About 1 day to fix

    File build.rb has 614 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Ci
      class Build < CommitStatus
        prepend ArtifactMigratable
        include Ci::Processable
        include Ci::Metadatable
    Severity: Major
    Found in app/models/ci/build.rb - About 1 day to fix

      Method persisted_environment_variables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def persisted_environment_variables
            Gitlab::Ci::Variables::Collection.new.tap do |variables|
              break variables unless persisted? && persisted_environment.present?
      
              variables.concat(persisted_environment.predefined_variables)
      Severity: Minor
      Found in app/models/ci/build.rb - About 35 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