diff --git a/gem/lib/rbi-central.rb b/gem/lib/rbi-central.rb index 2f42eba..3a6219a 100644 --- a/gem/lib/rbi-central.rb +++ b/gem/lib/rbi-central.rb @@ -64,7 +64,13 @@ module RBICentral Include: - 'rbi/**/*' - Sorbet/StrictSigil: + Sorbet/ValidSigil: + Enabled: true + MinimumStrictness: "true" + SuggestedStrictness: "true" + RequireSigilOnAllFiles: true + + Sorbet/EnforceSignatures: Enabled: true YML diff --git a/gem/test/rbi-central/cli/check_rubocop_test.rb b/gem/test/rbi-central/cli/check_rubocop_test.rb index 29d2169..c8bbe58 100644 --- a/gem/test/rbi-central/cli/check_rubocop_test.rb +++ b/gem/test/rbi-central/cli/check_rubocop_test.rb @@ -69,7 +69,7 @@ def test_rubocop_all_invalid } JSON @repo.write_annotations_file!("gem1", <<~RBI) - # typed: true + # typed: false module Gem1; end RBI @@ -85,9 +85,9 @@ module Gem2 Linting `gem1`... - Error: rbi/annotations/gem1.rbi:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true. - # typed: true - ^^^^^^^^^^^^^ + Error: rbi/annotations/gem1.rbi:1:1: C: Sorbet/ValidSigil: Sorbet sigil should be at least true got false. + # typed: false + ^^^^^^^^^^^^^^ Linting `gem2`... @@ -111,7 +111,7 @@ def test_rubocop_one_invalid module Gem1; end RBI @repo.write_annotations_file!("gem2", <<~RBI) - # typed: true + # typed: false module Gem2; end RBI @@ -121,9 +121,9 @@ module Gem2; end Linting `gem2`... - Error: rbi/annotations/gem2.rbi:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true. - # typed: true - ^^^^^^^^^^^^^ + Error: rbi/annotations/gem2.rbi:1:1: C: Sorbet/ValidSigil: Sorbet sigil should be at least true got false. + # typed: false + ^^^^^^^^^^^^^^ Some checks failed. See above for details. ERR diff --git a/gem/test/rbi-central/cli/check_test.rb b/gem/test/rbi-central/cli/check_test.rb index 0c29ebe..1c6cc41 100644 --- a/gem/test/rbi-central/cli/check_test.rb +++ b/gem/test/rbi-central/cli/check_test.rb @@ -121,10 +121,7 @@ module Gem2 Linting `gem1`... - Error: rbi/annotations/gem1.rbi:1:1: C: [Correctable] Sorbet/StrictSigil: No Sorbet sigil found in file. Try a typed: strict to start (you can also use rubocop -a to automatically add this). - class Gem1::NotFound; end - ^^^^^ - rbi/annotations/gem1.rbi:1:1: C: [Correctable] Sorbet/ValidSigil: No Sorbet sigil found in file. Try a typed: true to start (you can also use rubocop -a to automatically add this). + Error: rbi/annotations/gem1.rbi:1:1: C: [Correctable] Sorbet/ValidSigil: No Sorbet sigil found in file. Try a typed: true to start (you can also use rubocop -a to automatically add this). class Gem1::NotFound; end ^^^^^ diff --git a/gem/test/rbi-central/repo_test.rb b/gem/test/rbi-central/repo_test.rb index ac045f9..49e4bb8 100644 --- a/gem/test/rbi-central/repo_test.rb +++ b/gem/test/rbi-central/repo_test.rb @@ -143,15 +143,15 @@ module Spoom; end def test_check_rubocop_for_invalid @repo.write_annotations_file!("gem1", <<~RBI) - # typed: true + # typed: false module Spoom; end RBI errors = @repo.check_rubocop_for(Gem.new(name: "gem1")) assert_equal(<<~ERR, errors.first&.message) - rbi/annotations/gem1.rbi:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true. - # typed: true - ^^^^^^^^^^^^^ + rbi/annotations/gem1.rbi:1:1: C: Sorbet/ValidSigil: Sorbet sigil should be at least true got false. + # typed: false + ^^^^^^^^^^^^^^ ERR end diff --git a/rbi/annotations/aasm.rbi b/rbi/annotations/aasm.rbi index 67657ab..70e80ae 100644 --- a/rbi/annotations/aasm.rbi +++ b/rbi/annotations/aasm.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module AASM mixes_in_class_methods(AASM::ClassMethods) diff --git a/rbi/annotations/actionmailer.rbi b/rbi/annotations/actionmailer.rbi index a4cc666..bfcb739 100644 --- a/rbi/annotations/actionmailer.rbi +++ b/rbi/annotations/actionmailer.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class ActionMailer::Base sig { params(headers: T.untyped, block: T.nilable(T.proc.void)).returns(Mail::Message) } diff --git a/rbi/annotations/actionpack.rbi b/rbi/annotations/actionpack.rbi index 113b5ce..4968b12 100644 --- a/rbi/annotations/actionpack.rbi +++ b/rbi/annotations/actionpack.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class ActionController::API MODULES = T.let(T.unsafe(nil), T::Array[T.untyped]) diff --git a/rbi/annotations/actionview.rbi b/rbi/annotations/actionview.rbi index eea56e8..14a36f6 100644 --- a/rbi/annotations/actionview.rbi +++ b/rbi/annotations/actionview.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module ActionView TemplateError = T.type_alias { Template::Error } diff --git a/rbi/annotations/active_flag.rbi b/rbi/annotations/active_flag.rbi index b8f9f0c..224cabc 100644 --- a/rbi/annotations/active_flag.rbi +++ b/rbi/annotations/active_flag.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class ActiveRecord::Base # @shim: this is included at runtime https://github.com/kenn/active_flag/blob/master/lib/active_flag/railtie.rb#L6 diff --git a/rbi/annotations/activemodel.rbi b/rbi/annotations/activemodel.rbi index c2bb112..1649d2a 100644 --- a/rbi/annotations/activemodel.rbi +++ b/rbi/annotations/activemodel.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class ActiveModel::Errors Elem = type_member { { fixed: ActiveModel::Error } } diff --git a/rbi/annotations/activerecord.rbi b/rbi/annotations/activerecord.rbi index d0d4ed2..1e41cfc 100644 --- a/rbi/annotations/activerecord.rbi +++ b/rbi/annotations/activerecord.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class ActiveRecord::Schema sig {params(info: T::Hash[T.untyped, T.untyped], blk: T.proc.bind(ActiveRecord::Schema).void).void} diff --git a/rbi/annotations/activesupport.rbi b/rbi/annotations/activesupport.rbi index 3dd16df..6c79298 100644 --- a/rbi/annotations/activesupport.rbi +++ b/rbi/annotations/activesupport.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module ActiveSupport::Testing::Declarative sig { params(name: String, block: T.proc.bind(T.untyped).void).void } diff --git a/rbi/annotations/aws-sdk-acm.rbi b/rbi/annotations/aws-sdk-acm.rbi index a54fc67..11c53d7 100644 --- a/rbi/annotations/aws-sdk-acm.rbi +++ b/rbi/annotations/aws-sdk-acm.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class Aws::ACM::Client sig { params(params: T.untyped, options: T.untyped).returns(Aws::ACM::Types::DescribeCertificateResponse) } diff --git a/rbi/annotations/bencode.rbi b/rbi/annotations/bencode.rbi index 8bf9a33..3bf644b 100644 --- a/rbi/annotations/bencode.rbi +++ b/rbi/annotations/bencode.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class Array # Bencodes the Array object. Bencoded arrays are represented as +lxe+, where diff --git a/rbi/annotations/colorize.rbi b/rbi/annotations/colorize.rbi index a73154e..e27242b 100644 --- a/rbi/annotations/colorize.rbi +++ b/rbi/annotations/colorize.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class String extend Colorize::ClassMethods @@ -106,9 +106,6 @@ class String sig { returns(String) } def red; end - sig { returns(String) } - def swap; end - sig { returns(String) } def underline; end diff --git a/rbi/annotations/configs.rbi b/rbi/annotations/configs.rbi index c1d1171..79b94fb 100644 --- a/rbi/annotations/configs.rbi +++ b/rbi/annotations/configs.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module Configs sig { params(name: T.any(String, Symbol)).returns(ActiveSupport::HashWithIndifferentAccess) } diff --git a/rbi/annotations/delayed_job.rbi b/rbi/annotations/delayed_job.rbi index f521586..6268190 100644 --- a/rbi/annotations/delayed_job.rbi +++ b/rbi/annotations/delayed_job.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module Delayed::MessageSending sig { params(options: T.nilable(T::Hash[Symbol, T.untyped])).returns(T.self_type) } diff --git a/rbi/annotations/elasticsearch-dsl.rbi b/rbi/annotations/elasticsearch-dsl.rbi index aa02f2f..86892ef 100644 --- a/rbi/annotations/elasticsearch-dsl.rbi +++ b/rbi/annotations/elasticsearch-dsl.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module Elasticsearch::DSL::Search sig { params(args: T.untyped, block: T.proc.bind(Elasticsearch::DSL::Search::Search).void).void } diff --git a/rbi/annotations/faraday.rbi b/rbi/annotations/faraday.rbi index 28d03c4..558b83b 100644 --- a/rbi/annotations/faraday.rbi +++ b/rbi/annotations/faraday.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module Faraday class << self diff --git a/rbi/annotations/globalid.rbi b/rbi/annotations/globalid.rbi index cbf057c..687fb44 100644 --- a/rbi/annotations/globalid.rbi +++ b/rbi/annotations/globalid.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class ActiveRecord::Base # @shim: this is included at runtime https://github.com/rails/globalid/blob/v1.0.0/lib/global_id/railtie.rb#L38 diff --git a/rbi/annotations/graphql.rbi b/rbi/annotations/graphql.rbi index 80d1635..5c65b24 100644 --- a/rbi/annotations/graphql.rbi +++ b/rbi/annotations/graphql.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module GraphQL class << self diff --git a/rbi/annotations/kredis.rbi b/rbi/annotations/kredis.rbi index 6abdcca..cecafeb 100644 --- a/rbi/annotations/kredis.rbi +++ b/rbi/annotations/kredis.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module Kredis::Types sig { params(key: T.untyped, default: T.untyped, config: T.untyped, after_change: T.untyped, expires_in: T.untyped).returns(Kredis::Types::Scalar) } diff --git a/rbi/annotations/lhm-shopify.rbi b/rbi/annotations/lhm-shopify.rbi index 5f1c118..8858fc7 100644 --- a/rbi/annotations/lhm-shopify.rbi +++ b/rbi/annotations/lhm-shopify.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module Lhm extend Lhm diff --git a/rbi/annotations/lhm.rbi b/rbi/annotations/lhm.rbi index f56dd3d..c51a38a 100644 --- a/rbi/annotations/lhm.rbi +++ b/rbi/annotations/lhm.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module Lhm extend Lhm diff --git a/rbi/annotations/mocha.rbi b/rbi/annotations/mocha.rbi index 598068f..2508b8a 100644 --- a/rbi/annotations/mocha.rbi +++ b/rbi/annotations/mocha.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module Mocha::API sig { params(arguments: T.untyped).returns(Mocha::Mock) } diff --git a/rbi/annotations/parse-cron.rbi b/rbi/annotations/parse-cron.rbi index d89b0ec..58635ae 100644 --- a/rbi/annotations/parse-cron.rbi +++ b/rbi/annotations/parse-cron.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true # Parses cron expressions and computes the next occurence of the "job" class CronParser diff --git a/rbi/annotations/pundit.rbi b/rbi/annotations/pundit.rbi index 533bf65..3d50a71 100644 --- a/rbi/annotations/pundit.rbi +++ b/rbi/annotations/pundit.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module Pundit::Authorization sig { void } diff --git a/rbi/annotations/railties.rbi b/rbi/annotations/railties.rbi index 73eaeb7..2ac4e31 100644 --- a/rbi/annotations/railties.rbi +++ b/rbi/annotations/railties.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true module Rails class << self diff --git a/rbi/annotations/rainbow.rbi b/rbi/annotations/rainbow.rbi index 6d49b04..f8f4071 100644 --- a/rbi/annotations/rainbow.rbi +++ b/rbi/annotations/rainbow.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true module Rainbow # @shim: https://github.com/sickill/rainbow/blob/master/lib/rainbow.rb#L10-L12 diff --git a/rbi/annotations/shopify-money.rbi b/rbi/annotations/shopify-money.rbi index c930cf6..3c59fab 100644 --- a/rbi/annotations/shopify-money.rbi +++ b/rbi/annotations/shopify-money.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true class Money sig { returns(BigDecimal) } diff --git a/rbi/annotations/sidekiq-scheduler.rbi b/rbi/annotations/sidekiq-scheduler.rbi index 37c7e73..d5e3b50 100644 --- a/rbi/annotations/sidekiq-scheduler.rbi +++ b/rbi/annotations/sidekiq-scheduler.rbi @@ -1,4 +1,4 @@ -# typed: strong +# typed: true class SidekiqScheduler::Scheduler # @shim: Instance methods are made to function as class methods using `method_missing` diff --git a/rbi/annotations/sidekiq.rbi b/rbi/annotations/sidekiq.rbi index 34ebbe0..d7a3def 100644 --- a/rbi/annotations/sidekiq.rbi +++ b/rbi/annotations/sidekiq.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class Sidekiq::CLI sig { returns(Sidekiq::CLI) } @@ -11,7 +11,10 @@ end class Sidekiq::Client private + sig { params(item: T.untyped).returns(T.untyped) } def normalize_item(item); end + + sig { params(item_class: T.untyped).returns(T.untyped) } def normalized_hash(item_class); end end diff --git a/rbi/annotations/state_machines.rbi b/rbi/annotations/state_machines.rbi index dca2bf5..1a19041 100644 --- a/rbi/annotations/state_machines.rbi +++ b/rbi/annotations/state_machines.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class StateMachines::Machine include StateMachines::MatcherHelpers diff --git a/rbi/annotations/stripe.rbi b/rbi/annotations/stripe.rbi index 3b4bda1..e45d98d 100644 --- a/rbi/annotations/stripe.rbi +++ b/rbi/annotations/stripe.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class Stripe::APIResource < Stripe::StripeObject Elem = type_member { { fixed: T.untyped } } @@ -498,6 +498,7 @@ class Stripe::Invoice < Stripe::APIResource def subtotal; end # @method_missing: from StripeObject + sig { returns(T::Hash[T.untyped, T.untyped]) } def status_transitions; end end @@ -525,6 +526,7 @@ class Stripe::InvoiceItem < Stripe::APIResource # unsure how to represent a StripeObject with specific keys/mmethods without causing typing errors # @method_missing: from StripeObject + sig { returns(T::Hash[T.untyped, T.untyped]) } def period; end end @@ -648,6 +650,7 @@ class Stripe::Plan < Stripe::APIResource # unsure how to represent a StripeObject with specific keys/mmethods without causing typing errors # @method_missing: from StripeObject + sig { returns(T::Hash[T.untyped, T.untyped]) } def period; end # @method_missing: from StripeObject diff --git a/rbi/annotations/webmock.rbi b/rbi/annotations/webmock.rbi index 8489de8..ff00e69 100644 --- a/rbi/annotations/webmock.rbi +++ b/rbi/annotations/webmock.rbi @@ -1,4 +1,4 @@ -# typed: strict +# typed: true class Minitest::Test include WebMock::API