output all syntax errors at once
This commit is contained in:
@@ -27,10 +27,12 @@ describe 'wpscan main checks' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'should check for valid syntax' do
|
it 'should check for valid syntax' do
|
||||||
|
result = ""
|
||||||
Dir.glob("**/*.rb") do |file|
|
Dir.glob("**/*.rb") do |file|
|
||||||
res = %x{ruby -c #{ROOT_DIR}/#{file} 2>&1}.split("\n")
|
res = %x{ruby -c #{ROOT_DIR}/#{file} 2>&1}.split("\n")
|
||||||
ok = res.select {|msg| msg =~ /Syntax OK/}
|
ok = res.select {|msg| msg =~ /Syntax OK/}
|
||||||
fail("Syntax error in #{file}:\n" + res.join("\n")) if ok.size != 1
|
result << ("####################\nSyntax error in #{file}:\n#{res.join("\n").strip()}\n") if ok.size != 1
|
||||||
end
|
end
|
||||||
|
fail(result) unless result.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user