rosa-abf/rosa-build

View on GitHub
app/models/platform.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Showing 4 of 4 total issues

Class Platform has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class Platform < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: [:finders]
 
include FileStoreClean
Severity: Minor
Found in app/models/platform.rb - About 3 hrs to fix

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

    def self.allowed?(path, token)
    platform_name = path.gsub(/^[\/]+/, '')
    .match(/^(#{NAME_PATTERN}\/|#{NAME_PATTERN}$)/)
     
    return true unless platform_name
    Severity: Minor
    Found in app/models/platform.rb - About 2 hrs to fix

    Method cached_chroot has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def cached_chroot(arch)
    return false if personal?
    Rails.cache.fetch([:cached_chroot, name, arch], expires_in: 10.minutes) do
    product = products.where(name: CACHED_CHROOT_PRODUCT_NAME).first
    next false unless product
    Severity: Minor
    Found in app/models/platform.rb - About 1 hr to fix

    Method public_downloads_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def public_downloads_url(subplatform_name = nil, arch = nil, repo = nil)
    "#{APP_CONFIG['downloads_url']}/#{name}/repository/".tap do |url|
    url << "#{subplatform_name}/" if subplatform_name.present?
    url << "#{arch}/" if arch.present?
    url << "#{repo}/" if repo.present?
    Severity: Minor
    Found in app/models/platform.rb - About 25 mins to fix

    There are no issues that match your filters.

    Category
    Status