From bbdd23738801a84e0acfa53810142be687df2233 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Mon, 13 Nov 2023 21:55:49 -0800 Subject: [PATCH] Strictly type `file` --- common/lib/dependabot/config/file.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/common/lib/dependabot/config/file.rb b/common/lib/dependabot/config/file.rb index 6dd9c2512d..4a58691541 100644 --- a/common/lib/dependabot/config/file.rb +++ b/common/lib/dependabot/config/file.rb @@ -1,4 +1,4 @@ -# typed: true +# typed: strict # frozen_string_literal: true require "dependabot/config/update_config" @@ -10,11 +10,22 @@ module Config class File extend T::Sig - attr_reader :updates, :registries + sig { returns(T::Array[T::Hash[Symbol, String]]) } + attr_reader :updates + sig { returns T::Array[T.untyped] } + attr_reader :registries + + sig do + params( + updates: T.nilable(T::Array[T::Hash[Symbol, String]]), + registries: T.nilable(T::Array[T.untyped]) + ) + .void + end def initialize(updates:, registries: nil) - @updates = updates || [] - @registries = registries || [] + @updates = T.let(updates || [], T::Array[T::Hash[Symbol, String]]) + @registries = T.let(registries || [], T::Array[T.untyped]) end sig do