New Cop: Detect '/dev/null'
and suggest File::NULL
instead #13490
Closed
Description
Is your feature request related to a problem? Please describe.
Apologies if this is a duplicate or if it is not the correct repository.
I've encountered a hardcoded '/dev/null'
and am wondering if it would be useful to have a cop to detect this misuse.
I've also searched for occurrences on GitHub, and it appears to be quite common:
https://github.com/search?q=%22%27%2Fdev%2Fnull%27%22+language%3ARuby+path%3A.rb&type=code
Describe the solution you'd like
A cop that can detect '/dev/null'
or "/dev/null" and suggest using File::NULL
instead.
File::NULL
has been introduced in Ruby 1.9.3
Describe alternatives you've considered
n/a
Additional context
The cop should detect for exactly '/dev/null' or "/dev/null", because most Rakefile
s contain /dev/null
as part of a command (like >> /dev/null
) (and I guess they are platform-dependent
A CI failing on windows because of '/dev/null'
Metadata
Assignees
Labels
No labels