Stop being an idiot about the regex and rewrite it

There was no reason to shoehorn in zero-length assertions.
This commit is contained in:
William Vu 2018-10-05 13:24:45 -05:00
parent 40cb09b2e2
commit 2186322134
1 changed files with 1 additions and 2 deletions

View File

@ -256,8 +256,7 @@ class Msftidy
# This check also enforces namespace module name reversibility
def check_snake_case_filename
# TODO: Can we add the __ check to the look{ahead,behind}?
if @name !~ /^(?!_)[a-z0-9_]+(?<!_)\.rb$/ || @name.include?('__')
if @name !~ /^[a-z0-9]+(?:_[a-z0-9]+)*\.rb$/
warn('Filenames should be lowercase alphanumeric snake case.')
end
end