New gem rubocop-disable_syntax - rubocop extension to forbid unfavorite ruby syntax
Ruby is a sweet language, but sometimes is too sweet… If you have some unfavorite ruby syntax, e.g. unless, until, safe navigation, endless methods etc, you can now easily forbid it using the new rubocop extension - https://github.com/fatkodima/rubocop-disable_syntax
Currently, it allows to disable the following syntax:
-
unless- nounlesskeyword -
ternary- no ternary operator (condition ? foo : bar) -
safe_navigation- no safe navigation operator (&.) -
endless_methods- no endless methods (def foo = 1) -
arguments_forwarding- no arguments forwarding (foo(...),foo(*),foo(**),foo(&)) -
numbered_parameters- no numbered parameters (foo.each { puts _1 }) -
pattern_matching- no pattern matching -
shorthand_hash_syntax- no shorthand hash syntax ({ x:, y: }) -
and_or_not- noand/or/notkeywords (should use&&/||/!instead) -
until- nountilkeyword -
percent_literals- no any%style literals (%w[foo bar],%i[foo bar],%q("str"),%r{/regex/})
Post a comment