From 05ac3875bcb02c66c0e0d586447eb458e8f46a51 Mon Sep 17 00:00:00 2001 From: William Vu Date: Fri, 5 Oct 2018 11:30:45 -0500 Subject: [PATCH] Improve check_snake_case_filename check in msftidy We also remove the separator, since the file is basenamed. --- tools/dev/msftidy.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/dev/msftidy.rb b/tools/dev/msftidy.rb index e469d7d9ea..15cc049efa 100755 --- a/tools/dev/msftidy.rb +++ b/tools/dev/msftidy.rb @@ -254,11 +254,11 @@ class Msftidy line =~ /^\s*(require|load)\s+['"]#{lib}['"]/ end + # This check also enforces namespace module name reversibility def check_snake_case_filename - sep = File::SEPARATOR - good_name = Regexp.new "^[a-z0-9_#{sep}]+\.rb$" - unless @name =~ good_name - warn "Filenames should be alphanum and snake case." + # TODO: Can we add the __ check to the look{ahead,behind}? + if @name !~ /^(?!_)[a-z0-9_]+(?