Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
Lint/DeprecatedConstants
aware of Net::HTTPServerException
This PR makes `Lint/DeprecatedConstants` aware of `Net::HTTPServerException`. The following warning was introduced since Ruby 2.6. ```console % ruby -rnet/http -vwe 'p Net::HTTPServerException' ruby 2.6.8p205 (2021-07-07 revision 67951) [x86_64-darwin19] -e:1: warning: constant Net::HTTPServerException is deprecated Net::HTTPServerException ``` And `HTTPClientException` (alias) is used as an alternative to `HTTPServerException`. The following is the quote from Ruby 2.6.0 release news. > Add `Net::HTTPClientException` to deprecate `Net::HTTPServerException`, > whose name is misleading. [Bug #14688] https://github.com/ruby/ruby/blob/master/doc/NEWS-2.6.0 ```console % ruby -rnet/http -vwe 'p Net::HTTPClientException' ruby 2.6.8p205 (2021-07-07 revision 67951) [x86_64-darwin19] Net::HTTPServerException ``` `HTTPClientException` does not yet exist in Ruby 2.5, so the following error occurs. ```console % ruby -rnet/http -vwe 'p Net::HTTPClientException' ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-darwin19] Traceback (most recent call last): -e:1:in `<main>': uninitialized constant Net::HTTPClientException (NameError) Did you mean? Net::HTTPServerException ``` To prevent such errors, the cop's behavior is changed to detect only `DeprecatedVersion` or higher.
- Loading branch information
Showing
4 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/change_make_deprecated_constants_aware_of_net_http_server_exception.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#10209](https://github.com/rubocop/rubocop/pull/10209): Make `Lint/DeprecatedConstants` aware of `Net::HTTPServerException`. ([@koic][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters