Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix rubocop#8035] Fix a false positive for `Lint/DeprecatedOpenSSLCo…
…nstant` Fixes rubocop#8035. This PR fixes a false positive for `Lint/DeprecatedOpenSSLConstant` when argument is a variable, method, or constant. ```console % cat example.rb MODE = 'cbc' OpenSSL::Cipher::AES256.new(MODE) % bundle exec rubocop --only Lint/DeprecatedOpenSSLConstant -a (snip) Offenses: example.rb:2:1: W: [Corrected] Lint/DeprecatedOpenSSLConstant: Use OpenSSL::Cipher.new('AES-256-MODE') instead of OpenSSL::Cipher::AES256.new(MODE). OpenSSL::Cipher::AES256.new(MODE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected, 1 offense corrected % cat example.rb MODE = 'cbc' OpenSSL::Cipher.new('AES-256-MODE') ``` RuboCop does not have a tracing feature a value of variable, (method,) and constant yet. This PR accepts cases where these values are used to prevent auto-correction mistakes. On the other hand, this change produces false negatives for the deprecated APIs. If it is difficult to accept false negatives, I will update this PR to warn against these cases and auto-correction will not performed.
- Loading branch information