build: Use inline ignore for MediaWiki.Usage.ForbiddenFunctions

This avoids addition of new code with the function,
or at least it gives extra attention on review when new code also uses
the inline ignore

Change-Id: I17981b52d9f96ee5f19ba46cf370c7477c81a72a
This commit is contained in:
Umherirrender 2024-09-23 17:45:44 +02:00 committed by jenkins-bot
parent 286add50b5
commit 7c1ea4284e
3 changed files with 4 additions and 6 deletions

View file

@ -1,10 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Scribunto">
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Usage.ForbiddenFunctions.popen" />
<exclude name="MediaWiki.Usage.ForbiddenFunctions.proc_open" />
<exclude name="MediaWiki.Usage.ForbiddenFunctions.shell_exec" />
</rule>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" />

View file

@ -84,7 +84,7 @@ class LuaStandaloneEngine extends LuaEngine {
*/
protected function getClockTick() {
if ( self::$clockTick === null ) {
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged,MediaWiki.Usage.ForbiddenFunctions.shell_exec
self::$clockTick = intval( @shell_exec( 'getconf CLK_TCK' ) );
if ( !self::$clockTick ) {
self::$clockTick = 100;

View file

@ -156,6 +156,7 @@ class LuaStandaloneInterpreter extends LuaInterpreter {
// warning was generated by that.
error_clear_last();
// phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.proc_open
$this->proc = proc_open(
$cmd,
[
@ -205,6 +206,7 @@ class LuaStandaloneInterpreter extends LuaInterpreter {
// Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
// LuaJIT 2.0.0 -- Copyright (C) 2005-2012 Mike Pall. http://luajit.org/
$cmd = wfEscapeShellArg( $options['luaPath'] ) . ' -v 2>&1';
// phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.popen
$handle = popen( $cmd, 'r' );
if ( $handle ) {
$ret = fgets( $handle, 80 );