From 0c419b5babb360c10c29df02e62222a6ebba3c44 Mon Sep 17 00:00:00 2001 From: wraitii Date: Tue, 23 Mar 2021 17:43:19 +0000 Subject: [PATCH] CI linting: fix issues with char being null for cppcheck. The CPPCheck linter outputs 'char: null', which trips the phabricator-jenkins-plugin, and fails to lint on CI. To avoid this, filter out null values, since e.g. char is optional anyways. We do want to fail if non-optional values are missing. Differential Revision: https://code.wildfiregames.com/D3730 This was SVN commit r25112. --- build/arclint/pyrolint/src/JenkinsRenderer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/arclint/pyrolint/src/JenkinsRenderer.php b/build/arclint/pyrolint/src/JenkinsRenderer.php index 91c584b162..93dd5e4069 100644 --- a/build/arclint/pyrolint/src/JenkinsRenderer.php +++ b/build/arclint/pyrolint/src/JenkinsRenderer.php @@ -24,6 +24,10 @@ * The expected format is one line per message, as a dictionary. */ +function remove_null($val) { + return !is_null($val); +} + final class JenkinsRenderer extends ArcanistLintRenderer { const RENDERERKEY = 'jenkins'; @@ -43,7 +47,7 @@ final class JenkinsRenderer extends ArcanistLintRenderer { max(1, $message->getLine() - self::LINES_OF_CONTEXT), self::LINES_OF_CONTEXT * 2 + 1)); $dictionary['path'] = $path; - $this->writeOut(json_encode(json_decode(json_encode($dictionary)))."\n"); + $this->writeOut(json_encode(array_filter($dictionary, 'remove_null'))."\n"); } } }