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)
-- to represent a table
---
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
---
line = "# secfixes:"
line = line..":"
end
while line ~= nil and line:match("^#") do
......@@ -60,11 +60,24 @@ function readFile(file)
-- the end, match anything since we check later if this key is
-- actually writen with a valid pkgver and pkgrel
---
if l:match("^%s%s[%d]%S*[^:]$") then
violation("missing colon on '"..l:gsub("%s%s", "").."'", linenum, "38", "SC")
-- Add the colon at the end to represent a string
if (not l:match("^%s%s") or l:match("^%s%s%s")) then
le = l:gsub("^%s+", "")
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
---
-- Checks for possible CVE identifiers with the wrong identation
-- so match anything that doesn't start with 4 whitespaces and
......@@ -72,8 +85,9 @@ function readFile(file)
-- catch everything that is not purely 4 whitespaces and then
-- 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+", "")
---
-- Check if they begin with '- ' that means they have the correct mapping
-- 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