Updated to skip comments starting with #

This commit is contained in:
Stephen
2023-09-28 15:55:51 +10:00
parent 8f7246514e
commit 0d44721e04

View File

@@ -7,7 +7,11 @@ RSpec.describe 'BeEF Security Checks' do
next if %r{extensions/dns}.match(path) # skip this file
f.grep(/\Weval\W/im) do |line|
raise "Illegal use of 'eval' found in\n Path: #{path}\nLine: #{line}"
# check if comment starting with the '#' character
clean_line = line.downcase.gsub(/[ ]/, "")
if clean_line[0] != '#' # check first non-whitespace position
raise "Illegal use of 'eval' found in\n Path: #{path}\nLine: #{line}"
end
end
end
end