manual/cops_sorbet.md in rubocop-sorbet-0.8.1 vs manual/cops_sorbet.md in rubocop-sorbet-0.8.2

- old
+ new

@@ -293,10 +293,37 @@ --- | --- | --- SuggestedStrictness | `false` | String Include | `**/*.{rb,rbi,rake,ru}` | Array Exclude | `bin/**/*`, `db/**/*.rb`, `script/**/*` | Array +## Sorbet/ForbidComparableTEnum + +Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged +--- | --- | --- | --- | --- +Enabled | Yes | No | 0.8.2 | - + +Disallow including the `Comparable` module in `T::Enum`. + +### Examples + +```ruby +# bad +class Priority < T::Enum + include Comparable + + enums do + High = new(3) + Medium = new(2) + Low = new(1) + end + + def <=>(other) + serialize <=> other.serialize + end +end +``` + ## Sorbet/ForbidExtendTSigHelpersInShims Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged --- | --- | --- | --- | --- Enabled | Yes | Yes | 0.6.0 | - @@ -637,10 +664,37 @@ # good sig { params(b: String, a: Integer).void } def foo(b:, a: 1); end ``` +## Sorbet/MultipleTEnumValues + +Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged +--- | --- | --- | --- | --- +Enabled | Yes | No | 0.8.2 | - + +Disallow creating a `T::Enum` with less than two values. + +### Examples + +```ruby +# bad +class ErrorMessages < T::Enum + enums do + ServerError = new("There was a server error.") + end +end + +# good +class ErrorMessages < T::Enum + enums do + ServerError = new("There was a server error.") + NotFound = new("The resource was not found.") + end +end +``` + ## Sorbet/ObsoleteStrictMemoization Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged --- | --- | --- | --- | --- Enabled | Yes | Yes | 0.7.1 | - @@ -671,33 +725,9 @@ # good sig { returns(Foo) } def foo @foo ||= T.let(Foo.new, T.nilable(Foo)) -end -``` - -## Sorbet/OneAncestorPerLine - -Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged ---- | --- | --- | --- | --- -Disabled | Yes | Yes | 0.6.0 | - - -Ensures one ancestor per requires_ancestor line -rather than chaining them as a comma-separated list. - -### Examples - -```ruby -# bad -module SomeModule - requires_ancestor Kernel, Minitest::Assertions -end - -# good -module SomeModule - requires_ancestor Kernel - requires_ancestor Minitest::Assertions end ``` ## Sorbet/RedundantExtendTSig