rosa-abf/rosa-build

View on GitHub
app/services/abf_worker_service/rpm.rb

Summary

Maintainability
C
1 day
Test Coverage

Showing 4 of 4 total issues

Method build_rpms has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

def self.build_rpms(testing = false)
available_repos = BuildList.
select('MIN(updated_at) as min_updated_at, save_to_repository_id, build_for_platform_id').
where(new_core: true, status: (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)).
group(:save_to_repository_id, :build_for_platform_id).
Severity: Minor
Found in app/services/abf_worker_service/rpm.rb - About 4 hrs to fix

Method create has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def create
key = "#{save_to_repository_id}-#{build_for_platform_id}"
projects_for_cleanup = $redis.with { |r| r.lrange(PROJECTS_FOR_CLEANUP, 0, -1) }.select do |k|
(testing && k =~ /^testing-[\d]+-#{key}$/) || (!testing && k =~ /^[\d]+-#{key}$/)
end
Severity: Minor
Found in app/services/abf_worker_service/rpm.rb - About 3 hrs to fix

Method create has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def create
key = "#{save_to_repository_id}-#{build_for_platform_id}"
projects_for_cleanup = $redis.with { |r| r.lrange(PROJECTS_FOR_CLEANUP, 0, -1) }.select do |k|
(testing && k =~ /^testing-[\d]+-#{key}$/) || (!testing && k =~ /^[\d]+-#{key}$/)
end
Severity: Major
Found in app/services/abf_worker_service/rpm.rb - About 2 hrs to fix

    Method build_rpms has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def self.build_rpms(testing = false)
    available_repos = BuildList.
    select('MIN(updated_at) as min_updated_at, save_to_repository_id, build_for_platform_id').
    where(new_core: true, status: (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)).
    group(:save_to_repository_id, :build_for_platform_id).
    Severity: Minor
    Found in app/services/abf_worker_service/rpm.rb - About 1 hr to fix
      Category
      Status