RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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 - no unless keyword
  • 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 - no and/or/not keywords (should use &&/||/! instead)
  • until - no until keyword
  • percent_literals - no any % style literals (%w[foo bar], %i[foo bar], %q("str"), %r{/regex/})

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in