Sha256: 41866af89184836cb9ecc52a581e48bb7c199cb02f46515348dd3814822f72b4

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

# typed: strict

module CodeOwnership
  module Private
    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 :skip_codeowners_validation, T::Boolean

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

        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)
        )
      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
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
code_ownership-1.31.1 lib/code_ownership/private/configuration.rb
code_ownership-1.31.0 lib/code_ownership/private/configuration.rb
code_ownership-1.30.0 lib/code_ownership/private/configuration.rb
code_ownership-1.29.3 lib/code_ownership/private/configuration.rb
code_ownership-1.29.2 lib/code_ownership/private/configuration.rb
code_ownership-1.29.1 lib/code_ownership/private/configuration.rb
code_ownership-1.29.0 lib/code_ownership/private/configuration.rb
code_ownership-1.28.2 lib/code_ownership/private/configuration.rb
code_ownership-1.28.0 lib/code_ownership/private/configuration.rb
code_ownership-1.27.0 lib/code_ownership/private/configuration.rb
code_ownership-1.26.0 lib/code_ownership/private/configuration.rb
code_ownership-1.25.0 lib/code_ownership/private/configuration.rb
code_ownership-1.24.0 lib/code_ownership/private/configuration.rb
code_ownership-1.23.0 lib/code_ownership/private/configuration.rb