Skip to content

Commit

Permalink
Merge pull request #285 from Shopify/at-fix-message
Browse files Browse the repository at this point in the history
Make deprecations about the codebase
  • Loading branch information
Morriar authored Feb 20, 2025
2 parents 172d5f0 + a249077 commit 6a32550
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/rubocop/cop/sorbet/forbid_t_enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Sorbet
# C = "c"
# end
class ForbidTEnum < RuboCop::Cop::Base
MSG = "Using `T::Enum` is deprecated."
MSG = "Using `T::Enum` is deprecated in this codebase."

# @!method t_enum?(node)
def_node_matcher(:t_enum?, <<~PATTERN)
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/sorbet/forbid_t_struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ForbidTStruct < RuboCop::Cop::Base

RESTRICT_ON_SEND = [:include, :prepend, :extend].freeze

MSG_STRUCT = "Using `T::Struct` or its variants is deprecated."
MSG_PROPS = "Using `T::Props` or its variants is deprecated."
MSG_STRUCT = "Using `T::Struct` or its variants is deprecated in this codebase."
MSG_PROPS = "Using `T::Props` or its variants is deprecated in this codebase."

# This class walks down the class body of a T::Struct and collects all the properties that will need to be
# translated into `attr_reader` and `attr_accessor` methods.
Expand Down
10 changes: 5 additions & 5 deletions spec/rubocop/cop/sorbet/forbid_t_enum_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
it "adds offense when inheriting T::Enum on a multiline class" do
expect_offense(<<~RUBY)
class Foo < T::Enum
^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated.
^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated in this codebase.
end
RUBY
end

it "adds offense when inheriting T::Enum on a singleline class" do
expect_offense(<<~RUBY)
class Foo < T::Enum; end
^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated in this codebase.
RUBY
end

it "adds offense when inheriting ::T::Enum" do
expect_offense(<<~RUBY)
class Foo < ::T::Enum; end
^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated in this codebase.
RUBY
end

it "adds offense for nested enums" do
expect_offense(<<~RUBY)
class Foo < T::Enum
^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated.
^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated in this codebase.
class Bar < T::Enum
^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated.
^^^^^^^^^^^^^^^^^^^ Using `T::Enum` is deprecated in this codebase.
end
end
RUBY
Expand Down
26 changes: 13 additions & 13 deletions spec/rubocop/cop/sorbet/forbid_t_struct_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@
it "adds offense when inheriting T::Struct on a multiline class" do
expect_offense(<<~RUBY)
class Foo < T::Struct
^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
end
RUBY
end

it "adds offense when inheriting T::Struct on a singleline class" do
expect_offense(<<~RUBY)
class Foo < T::Struct; end
^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
RUBY
end

it "adds offense when inheriting ::T::Struct" do
expect_offense(<<~RUBY)
class Foo < ::T::Struct; end
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
RUBY
end

it "adds offense when inheriting T::ImmutableStruct" do
expect_offense(<<~RUBY)
class Foo < T::ImmutableStruct
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
end
RUBY
end

it "adds offense when inheriting T::InexactStruct" do
expect_offense(<<~RUBY)
class Foo < T::InexactStruct
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
end
RUBY
end
Expand All @@ -46,27 +46,27 @@ class Foo < T::InexactStruct
expect_offense(<<~RUBY)
class Foo
include T::Props
^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated.
^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated in this codebase.
include T::Props::Constructor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated in this codebase.
include T::Props::WeakConstructor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated in this codebase.
prepend T::Props::Foo
^^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated in this codebase.
extend T::Props::Bar
^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated in this codebase.
extend ::T::Props
^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated.
^^^^^^^^^^^^^^^^^ Using `T::Props` or its variants is deprecated in this codebase.
end
RUBY
end

it "adds offense for nested structs" do
expect_offense(<<~RUBY)
class Foo < T::Struct
^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
class Bar < T::Struct
^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated.
^^^^^^^^^^^^^^^^^^^^^ Using `T::Struct` or its variants is deprecated in this codebase.
end
end
RUBY
Expand Down

0 comments on commit 6a32550

Please sign in to comment.