gitlabhq/gitlab-ci

View on GitHub
lib/gitlab_ci_yaml_processor.rb

Summary

Maintainability
C
1 day
Test Coverage

Method process? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def process?(only_params, except_params, ref, tag)
    return true if only_params.nil? && except_params.nil?

    if only_params
      return true if tag && only_params.include?("tags")
Severity: Minor
Found in lib/gitlab_ci_yaml_processor.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 validate_job! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_job!(name, job)
    job.keys.each do |key|
      unless ALLOWED_JOB_KEYS.include? key
        raise ValidationError, "#{name}: unknown parameter #{key}"
      end
Severity: Minor
Found in lib/gitlab_ci_yaml_processor.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 validate! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def validate!
    unless validate_array_of_strings(@before_script)
      raise ValidationError, "before_script should be an array of strings"
    end

Severity: Minor
Found in lib/gitlab_ci_yaml_processor.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 validate_job! has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_job!(name, job)
    job.keys.each do |key|
      unless ALLOWED_JOB_KEYS.include? key
        raise ValidationError, "#{name}: unknown parameter #{key}"
      end
Severity: Minor
Found in lib/gitlab_ci_yaml_processor.rb - About 1 hr to fix

    Method initial_parsing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def initial_parsing
        @before_script = @config[:before_script] || []
        @image = @config[:image]
        @services = @config[:services]
        @stages = @config[:stages] || @config[:types]
    Severity: Minor
    Found in lib/gitlab_ci_yaml_processor.rb - About 45 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

    Avoid too many return statements within this method.
    Open

          return false if !tag && except_params.include?("branches")
    Severity: Major
    Found in lib/gitlab_ci_yaml_processor.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return false if match_ref?(pattern, ref)
      Severity: Major
      Found in lib/gitlab_ci_yaml_processor.rb - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status