openSUSE/open-build-service

View on GitHub
src/api/app/jobs/old/consistency_check_job.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
11%

Method package_existence_consistency_check has a Cognitive Complexity of 35 (exceeds 8 allowed). Consider refactoring.
Wontfix

    def package_existence_consistency_check(project, fix = nil)
      errors = ''
      begin
        project.reload
      rescue ActiveRecord::RecordNotFound
Severity: Minor
Found in src/api/app/jobs/old/consistency_check_job.rb - About 4 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 package_existence_consistency_check has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

    def package_existence_consistency_check(project, fix = nil)
      errors = ''
      begin
        project.reload
      rescue ActiveRecord::RecordNotFound
Severity: Major
Found in src/api/app/jobs/old/consistency_check_job.rb - About 2 hrs to fix

    Method hash_diff has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
    Wontfix

        def hash_diff(a, b)
          # ignore the order inside of the hash
          (a.keys | b.keys).sort!.each_with_object({}) do |diff, k|
            a_ = a[k]
            b_ = b[k]
    Severity: Minor
    Found in src/api/app/jobs/old/consistency_check_job.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 project_existence_consistency_check has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
    Wontfix

        def project_existence_consistency_check(fix = nil)
          errors = ''
          # compare projects
          project_list_api = Project.order(:name).pluck(:name)
          begin
    Severity: Minor
    Found in src/api/app/jobs/old/consistency_check_job.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 project_existence_consistency_check has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

        def project_existence_consistency_check(fix = nil)
          errors = ''
          # compare projects
          project_list_api = Project.order(:name).pluck(:name)
          begin
    Severity: Minor
    Found in src/api/app/jobs/old/consistency_check_job.rb - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status