Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Sorbet/StrictSigil to Safe: false #268

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rubocop-sorbet (0.8.7)
rubocop-sorbet (0.8.8)
rubocop (>= 1)

GEM
Expand Down
1 change: 1 addition & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/sorbet/callback_conditionals_binding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions lib/rubocop/cop/sorbet/sigils/strict_sigil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/sorbet/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module RuboCop
module Sorbet
VERSION = "0.8.7"
VERSION = "0.8.8"
end
end
15 changes: 14 additions & 1 deletion manual/cops_sorbet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading