Skip to content

Commit 47e2533

Browse files
committed
Make unparsed code harder to read
1 parent 5751c1f commit 47e2533

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/prometheus/unparser.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,11 @@ function Unparser:unparseExpression(expression, tabbing)
814814
local p = false;
815815
for i, entry in ipairs(expression.entries) do
816816
p = true;
817+
local sep = self.prettyPrint and "," or (math.random(1, 2) == 1 and "," or ";");
817818
if i > 1 and not inlineTable then
818-
code = code .. "," .. self:optionalWhitespace(self:newline() .. self:tabs(tableTabbing));
819+
code = code .. sep .. self:optionalWhitespace(self:newline() .. self:tabs(tableTabbing));
819820
elseif i > 1 then
820-
code = code .. "," .. self:optionalWhitespace();
821+
code = code .. sep .. self:optionalWhitespace();
821822
end
822823
if(entry.kind == AstKind.KeyedTableEntry) then
823824
if(entry.key.kind == AstKind.StringExpression and self:isValidIdentifier(entry.key.value)) then

0 commit comments

Comments
 (0)