From 4e32bfce22366d05efc1363c9b7e2ed690180ff4 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Mon, 13 Feb 2012 21:03:13 -0600 Subject: [PATCH] Add a check for poorly designed arg list --- tools/msftidy.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/msftidy.rb b/tools/msftidy.rb index 263ec54af5..de1138c18e 100755 --- a/tools/msftidy.rb +++ b/tools/msftidy.rb @@ -98,6 +98,15 @@ def check_single_file(dparts, fparts, f_rel) show_missing(f, 'WARNING: contains "stack overflow" You mean "stack exhaustion"?', bad_term) end + # If a function has more than 6 arguments, it should use a hash instead + functions = content.scan(/def (\w+)\(*(.+)\)*/) + functions.each do |func_name, args| + args_length = args.split(",").length + if args_length > 6 + show_missing(f, "WARNING: Poorly designed argument list in '#{func_name}'. Try a hash.", false) + end + end + # check criteria based on individual lines spaces = 0 bi = []