Sha256: cdc4464e73dd3a3836cb7093ae51f5fdcca3fcde75772b268e37d3ad7ca31aa7

Contents?: true

Size: 1.38 KB

Versions: 24

Compression:

Stored size: 1.38 KB

Contents

# typed: strict

module CodeOwnership
  class Configuration < T::Struct
    extend T::Sig
    DEFAULT_JS_PACKAGE_PATHS = T.let(['**/'], T::Array[String])

    const :owned_globs, T::Array[String]
    const :unowned_globs, T::Array[String]
    const :js_package_paths, T::Array[String]
    const :unbuilt_gems_path, T.nilable(String)
    const :skip_codeowners_validation, T::Boolean
    const :raw_hash, T::Hash[T.untyped, T.untyped]

    sig { returns(Configuration) }
    def self.fetch
      config_hash = YAML.load_file('config/code_ownership.yml')

      if config_hash.key?("require")
        config_hash["require"].each do |require_directive|
          Private::ExtensionLoader.load(require_directive)
        end
      end

      new(
        owned_globs: config_hash.fetch('owned_globs', []),
        unowned_globs: config_hash.fetch('unowned_globs', []),
        js_package_paths: js_package_paths(config_hash),
        skip_codeowners_validation: config_hash.fetch('skip_codeowners_validation', false),
        raw_hash: config_hash
      )
    end

    sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[String]) }
    def self.js_package_paths(config_hash)
      specified_package_paths = config_hash['js_package_paths']
      if specified_package_paths.nil?
        DEFAULT_JS_PACKAGE_PATHS.dup
      else
        Array(specified_package_paths)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
code_ownership-1.34.2 lib/code_ownership/configuration.rb
code_ownership-1.34.1 lib/code_ownership/configuration.rb
code_ownership-1.33.1 lib/code_ownership/configuration.rb
code_ownership-1.33.0 lib/code_ownership/configuration.rb
code_ownership-1.32.19 lib/code_ownership/configuration.rb
code_ownership-1.32.18 lib/code_ownership/configuration.rb
code_ownership-1.32.17 lib/code_ownership/configuration.rb
code_ownership-1.32.16 lib/code_ownership/configuration.rb
code_ownership-1.32.15 lib/code_ownership/configuration.rb
code_ownership-1.32.14 lib/code_ownership/configuration.rb
code_ownership-1.32.13 lib/code_ownership/configuration.rb
code_ownership-1.32.12 lib/code_ownership/configuration.rb
code_ownership-1.32.11 lib/code_ownership/configuration.rb
code_ownership-1.32.10 lib/code_ownership/configuration.rb
code_ownership-1.32.9 lib/code_ownership/configuration.rb
code_ownership-1.32.8 lib/code_ownership/configuration.rb
code_ownership-1.32.7 lib/code_ownership/configuration.rb
code_ownership-1.32.6 lib/code_ownership/configuration.rb
code_ownership-1.32.5 lib/code_ownership/configuration.rb
code_ownership-1.32.4 lib/code_ownership/configuration.rb