r7kamura / rspec-json_matcher

RSpec matcher for testing JSON string
MIT License
171 stars 10 forks source link

Style/SpecialGlobalVars-20220512232154 #21

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Rubocop challenge!

Style/SpecialGlobalVars

Safe autocorrect: No :warning: The auto-correct a cop can yield false positives by design.

Description

Overview

This cop looks for uses of Perl-style global variables. Correcting to global variables in the 'English' library will add a require statement to the top of the file if enabled by RequireEnglish config.

Like use_perl_names but allows builtin global vars.

good

puts $LOAD_PATH puts $LOADED_FEATURES puts $PROGRAMNAME puts ARGV puts $: puts $" puts $0 puts $! puts $@ puts $; puts $, puts $/ puts $\ puts $. puts $ puts $> puts $< puts $$ puts $? puts $~ puts $= puts $*

Examples

EnforcedStyle: use_english_names (default)

# good
require 'English' # or this could be in another file.

puts $LOAD_PATH
puts $LOADED_FEATURES
puts $PROGRAM_NAME
puts $ERROR_INFO
puts $ERROR_POSITION
puts $FIELD_SEPARATOR # or $FS
puts $OUTPUT_FIELD_SEPARATOR # or $OFS
puts $INPUT_RECORD_SEPARATOR # or $RS
puts $OUTPUT_RECORD_SEPARATOR # or $ORS
puts $INPUT_LINE_NUMBER # or $NR
puts $LAST_READ_LINE
puts $DEFAULT_OUTPUT
puts $DEFAULT_INPUT
puts $PROCESS_ID # or $PID
puts $CHILD_STATUS
puts $LAST_MATCH_INFO
puts $IGNORECASE
puts $ARGV # or ARGV

EnforcedStyle: use_perl_names

# good
puts $:
puts $"
puts $0
puts $!
puts $@
puts $;
puts $,
puts $/
puts $\
puts $.
puts $_
puts $>
puts $<
puts $$
puts $?
puts $~
puts $=
puts $*

EnforcedStyle: use_builtin_english_names

Auto generated by rubocop_challenger