Skip to content

Commit 2b9c043

Browse files
committed
No more check_executable, check extname instead.
When File.executable?() is used, it checks if the file is an executable AND that exe permission is set. Well, we don't really have to set the permission we can still load/use the module. So really, all we care is the module must be a ".rb" to make sure it loads at startup. So that's what we need to check.
1 parent 2bbbbee commit 2b9c043

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/msftidy.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def error(txt, line=0)
5858
#
5959
##
6060

61-
def check_executable
62-
if not File.executable?(@name)
63-
warn("File is not executable. Double check your file type and permissions.")
61+
def check_extname
62+
if File.extname(@name) != '.rb'
63+
error("Module should be a '.rb' file, or it won't load.")
6464
end
6565
end
6666

@@ -228,7 +228,7 @@ def load_file(file)
228228

229229
def run_checks(f_rel)
230230
tidy = Msftidy.new(f_rel)
231-
tidy.check_executable
231+
tidy.check_extname
232232
tidy.test_old_rubies(f_rel)
233233
tidy.check_ranking
234234
tidy.check_disclosure_date

0 commit comments

Comments
 (0)