1
0
forked from mirrors/0ad

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.
This commit is contained in:
wraitii
2021-03-23 17:43:19 +00:00
parent de02f9870c
commit 0c419b5bab
@@ -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");
}
}
}