From a89c08ba3a7242a10e4c9f9acd26d529511c2a5f Mon Sep 17 00:00:00 2001 From: arjun Date: Sun, 22 Aug 2021 06:59:03 +0530 Subject: [PATCH] [Fix rubocop#9328] Add co-author, simple documentation --- changelog/change_recognize_shareable_constant_value_magic.md | 2 +- lib/rubocop/cop/style/mutable_constant.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog/change_recognize_shareable_constant_value_magic.md b/changelog/change_recognize_shareable_constant_value_magic.md index c0cccef66b5..eed14490de6 100644 --- a/changelog/change_recognize_shareable_constant_value_magic.md +++ b/changelog/change_recognize_shareable_constant_value_magic.md @@ -1 +1 @@ -* [#9328](https://github.com/rubocop/rubocop/issues/9328): Recognize shareable_constant_value magic comment. ([@thearjunmdas][]) +* [#9328](https://github.com/rubocop/rubocop/issues/9328): Recognize shareable_constant_value magic comment. ([@thearjunmdas][], [@caalberts][]) diff --git a/lib/rubocop/cop/style/mutable_constant.rb b/lib/rubocop/cop/style/mutable_constant.rb index 725c8122a50..cba0d859a2e 100644 --- a/lib/rubocop/cop/style/mutable_constant.rb +++ b/lib/rubocop/cop/style/mutable_constant.rb @@ -14,6 +14,11 @@ module Style # positives. Luckily, there is no harm in freezing an already # frozen object. # + # From Ruby 3.0, this cop honours the magic comment + # 'shareable_constant_value'. When this magic comment is set to any + # acceptable value other than none, it will suppress the offenses + # raised by this cop. It enforces frozen state. + # # NOTE: Regexp and Range literals are frozen objects since Ruby 3.0. # # @example EnforcedStyle: literals (default)