New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add use_builtin_english_names
style to Style/SpecialGlobalVars
#10521
Add use_builtin_english_names
style to Style/SpecialGlobalVars
#10521
Conversation
21886bf
to
2d16f70
Compare
PERL_VARS = ENGLISH_VARS.flat_map { |k, vs| vs.map { |v| [v, [k]] } }.to_h | ||
|
||
ENGLISH_VARS.merge!(ENGLISH_VARS.flat_map { |_, vs| vs.map { |v| [v, [v]] } }.to_h) | ||
PERL_VARS.merge!(PERL_VARS.flat_map { |_, vs| vs.map { |v| [v, [v]] } }.to_h) | ||
BUILTIN_VARS = PERL_VARS.merge( | ||
NON_ENGLISH_VARS | ||
.select { |v| v.start_with?('$') } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to workaround the ❄️ ARGV
otherwise we keep suggesting to use ARGV
for $*
with use_builtin_names
which is not what we want here.
I'm fine with the proposal, but I'm not sure that the option name is clear - I mean the Perl-style names are all built-in as well. :-) I don't have any great alternatives though - only |
@bbatsov Yes, you are right 😅 Would be @godfat Do you have other suggestions? 🙏 |
It behaves like `use_perl_names` but enforces some builtin global English variables which does not need to `require "English"`: * $LOAD_PATH * $LOADED_FEATURES * $PROGRAM_NAME
2d16f70
to
fd20b9a
Compare
use_builtin_names
style to Style/SpecialGlobalVars
use_builtin_english_names
style to Style/SpecialGlobalVars
@splattael I like `use_builtin_english_names`. It does suggest that it
should use whichever builtin English names it has. Thank you so much for
working on this! ❤️
|
Thanks! |
Refs #5891
It behaves like
use_perl_names
but enforces some builtin globalEnglish variables which does not need to
require "English"
:Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.