Skip to content

Files

Latest commit

 

History

History
26 lines (18 loc) · 427 Bytes

Lint-RegexpAsCondition.md

File metadata and controls

26 lines (18 loc) · 427 Bytes

Pattern: Regexp as condition

Issue: -

Description

This rule checks for regexp literals used as match-current-line. If a regexp literal is in condition, the regexp matches $_ implicitly.

Examples

# bad
if /foo/
  do_something
end

# good
if /foo/ =~ $_
  do_something
end

Further Reading