Commit 6faf8b73 authored by Leo's avatar Leo

implement pkgver-pkgrel-wrong-indent and a few fixes

parent fe09da06
...@@ -43,11 +43,11 @@ function readFile(file) ...@@ -43,11 +43,11 @@ function readFile(file)
-- to represent a table -- to represent a table
--- ---
if line:match("^# secfixes$") then if line:match("^# secfixes$") then
violation("missing colon on '"..line.."'", linenum, "37", "SC") violation("missing colon on '"..line:gsub("^# ", "").."'", linenum, "37", "SC")
--- ---
-- Rewrite the string to be valid yaml after triggering a violation -- Rewrite the string to be valid yaml after triggering a violation
--- ---
line = "# secfixes:" line = line..":"
end end
while line ~= nil and line:match("^#") do while line ~= nil and line:match("^#") do
...@@ -60,10 +60,23 @@ function readFile(file) ...@@ -60,10 +60,23 @@ function readFile(file)
-- the end, match anything since we check later if this key is -- the end, match anything since we check later if this key is
-- actually writen with a valid pkgver and pkgrel -- actually writen with a valid pkgver and pkgrel
--- ---
if l:match("^%s%s[%d]%S*[^:]$") then if (not l:match("^%s%s") or l:match("^%s%s%s")) then
violation("missing colon on '"..l:gsub("%s%s", "").."'", linenum, "38", "SC") le = l:gsub("^%s+", "")
-- Add the colon at the end to represent a string
l = l..":" if le:match("^%d%S*%-r") then
violation("pkgver-pkgrel indentation is 3 whitespaces", linenum, "48", "SC")
l = le:gsub("^", " ")
if le:match("^%d%S*[^:]$") then
violation("missing colon on '"..le.."'", linenum, "38", "SC")
l = l..":"
end
end
end
if (l:match("^%s%s") and l:match("^%s%s%d")) then
if (l:match("^%s%s%d%S*%-r") and l:match("^%s%s%d%S*[^:]$")) then
violation("missing colon on '"..l:gsub("^%s+", "").."'", linenum, "38", "SC")
l = l..":"
end
end end
--- ---
-- Checks for possible CVE identifiers with the wrong identation -- Checks for possible CVE identifiers with the wrong identation
...@@ -72,8 +85,9 @@ function readFile(file) ...@@ -72,8 +85,9 @@ function readFile(file)
-- catch everything that is not purely 4 whitespaces and then -- catch everything that is not purely 4 whitespaces and then
-- not an whitespace -- not an whitespace
--- ---
if not (l:match("^%s%s%s%s") or l:match("^%s%s%s%s%s")) then if (not l:match("^%s%s%s%s") or l:match("^%s%s%s%s%s")) then
le = l:gsub("^%s+", "") le = l:gsub("^%s+", "")
--- ---
-- Check if they begin with '- ' that means they have the correct mapping -- Check if they begin with '- ' that means they have the correct mapping
-- for yaml and merely have the wrong indentation -- for yaml and merely have the wrong indentation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment