diff --git a/Gemfile.lock b/Gemfile.lock index 55b48bb..763cb3a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rubocop-sorbet (0.8.7) + rubocop-sorbet (0.8.8) rubocop (>= 1) GEM diff --git a/config/default.yml b/config/default.yml index 65e6d23..b3f66a2 100644 --- a/config/default.yml +++ b/config/default.yml @@ -252,6 +252,7 @@ Sorbet/SingleLineRbiClassModuleDefinitions: Sorbet/StrictSigil: Description: 'All files must be at least at strictness `strict`.' Enabled: false + Safe: false SuggestedStrictness: "strict" VersionAdded: 0.3.3 Include: diff --git a/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb b/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb index 4f8a6a3..4d56ab3 100644 --- a/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb +++ b/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb @@ -6,6 +6,7 @@ module Sorbet # Ensures that callback conditionals are bound to the right type # so that they are type checked properly. # + # @safety # 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-correction # introduces new typing errors. diff --git a/lib/rubocop/cop/sorbet/sigils/strict_sigil.rb b/lib/rubocop/cop/sorbet/sigils/strict_sigil.rb index 9dd7b80..13e71e7 100644 --- a/lib/rubocop/cop/sorbet/sigils/strict_sigil.rb +++ b/lib/rubocop/cop/sorbet/sigils/strict_sigil.rb @@ -7,6 +7,21 @@ module RuboCop module Cop module Sorbet # Makes the Sorbet `strict` sigil mandatory in all files. + # + # @safety + # This cop is unsafe because Sorbet sigils may not exist yet when it is run. + # + # @example + # + # # bad + # # typed: true + # + # # bad + # # typed: false + # + # # good + # # typed: strict + # class StrictSigil < HasSigil def minimum_strictness "strict" diff --git a/lib/rubocop/sorbet/version.rb b/lib/rubocop/sorbet/version.rb index bb68616..519dae2 100644 --- a/lib/rubocop/sorbet/version.rb +++ b/lib/rubocop/sorbet/version.rb @@ -2,6 +2,6 @@ module RuboCop module Sorbet - VERSION = "0.8.7" + VERSION = "0.8.8" end end diff --git a/manual/cops_sorbet.md b/manual/cops_sorbet.md index 4c21e32..ec249fb 100644 --- a/manual/cops_sorbet.md +++ b/manual/cops_sorbet.md @@ -860,10 +860,23 @@ Include | `**/*.rbi` | Array Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged --- | --- | --- | --- | --- -Disabled | Yes | Yes | 0.3.3 | - +Disabled | No | Yes | 0.3.3 | - Makes the Sorbet `strict` sigil mandatory in all files. +### Examples + +```ruby +# bad +# typed: true + +# bad +# typed: false + +# good +# typed: strict +``` + ### Configurable attributes Name | Default value | Configurable values