rosa-abf/rosa-build

View on GitHub
app/models/build_list.rb

Summary

Maintainability
D
2 days
Test Coverage

Showing 7 of 7 total issues

File build_list.rb has 621 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class BuildList < ActiveRecord::Base
include CommitAndVersion
include FileStoreClean
include AbfWorkerMethods
include Feed::BuildList
Severity: Major
Found in app/models/build_list.rb - About 1 day to fix

    Class BuildList has 45 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class BuildList < ActiveRecord::Base
    include CommitAndVersion
    include FileStoreClean
    include AbfWorkerMethods
    include Feed::BuildList
    Severity: Minor
    Found in app/models/build_list.rb - About 6 hrs to fix

      Method abf_worker_args has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def abf_worker_args
      repos = include_repos
      include_repos_hash = {}.tap do |h|
      Repository.where(id: (repos | (extra_repositories || [])) ).each do |repo|
      path, prefix = repo.platform.public_downloads_url(
      Severity: Major
      Found in app/models/build_list.rb - About 2 hrs to fix

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

        def abf_worker_args
        repos = include_repos
        include_repos_hash = {}.tap do |h|
        Repository.where(id: (repos | (extra_repositories || [])) ).each do |repo|
        path, prefix = repo.platform.public_downloads_url(
        Severity: Minor
        Found in app/models/build_list.rb - About 2 hrs to fix

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

        def has_new_packages?
        if last_bl = last_published.joins(:source_packages).where(build_list_packages: {actual: true}).last
        source_packages.each do |nsp|
        sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name }
        return true unless sp
        Severity: Minor
        Found in app/models/build_list.rb - About 1 hr to fix

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

        def prepare_extra_build_lists
        if mass_build && mass_build.extra_mass_builds.present?
        extra_build_lists << BuildList.where(mass_build_id: mass_build.extra_mass_builds).pluck(:id)
        extra_build_lists.flatten!
        end
        Severity: Minor
        Found in app/models/build_list.rb - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

        return false # no new packages
        Severity: Major
        Found in app/models/build_list.rb - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status