diff --git a/config/default.yml b/config/default.yml index 56c1e04a..809709bc 100644 --- a/config/default.yml +++ b/config/default.yml @@ -16,7 +16,8 @@ Sorbet/BindingConstantWithoutTypeAlias: Sorbet/CallbackConditionalsBinding: Description: 'Ensures callback conditionals are bound to the right type.' - Enabled: true + Enabled: false + Safe: false VersionAdded: 0.7.0 Sorbet/CheckedTrueInSignature: diff --git a/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb b/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb index 7020adc8..d945a5f0 100644 --- a/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb +++ b/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb @@ -6,6 +6,10 @@ module Sorbet # This cop ensures that callback conditionals are bound to the right type # so that they are type checked properly. # + # Auto-correction is unsafe because other libraries define similar style callbacks as Rails, but don't always need + # binding to the attached class. Auto-correcting those usages can lead to false positives and auto-corretion + # introduces new typing errors. + # # @example # # # bad diff --git a/manual/cops_sorbet.md b/manual/cops_sorbet.md index 698605e2..fe6b745f 100644 --- a/manual/cops_sorbet.md +++ b/manual/cops_sorbet.md @@ -45,11 +45,15 @@ FooOrBar = T.type_alias { T.any(Foo, Bar) } Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged --- | --- | --- | --- | --- -Enabled | Yes | Yes | 0.7.0 | - +Disabled | No | Yes | 0.7.0 | - This cop ensures that callback conditionals are bound to the right type so that they are type checked properly. +Auto-correction is unsafe because other libraries define similar style callbacks as Rails, but don't always need +binding to the attached class. Auto-correcting those usages can lead to false positives and auto-corretion +introduces new typing errors. + ### Examples ```ruby