fix code smells and set baseline

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2023-02-28 13:44:15 +01:00
Родитель 56108959d1
Коммит 850b8ded6a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7424F1874854DF23
2 изменённых файлов: 31 добавлений и 3 удалений

Просмотреть файл

@ -51,7 +51,6 @@ use OCP\WorkflowEngine\IManager;
use OCP\WorkflowEngine\IRuleMatcher;
use OCP\WorkflowEngine\ISpecificOperation;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\GenericEvent as LegacyGenericEvent;
use UnexpectedValueException;
class Operation implements ISpecificOperation {
@ -120,7 +119,6 @@ class Operation implements ISpecificOperation {
public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatcher): void {
if (!$event instanceof GenericEvent
&& !$event instanceof LegacyGenericEvent
&& !$event instanceof MapperEvent) {
return;
}
@ -218,7 +216,7 @@ class Operation implements ISpecificOperation {
$nodeID = $node->getId();
} catch (InvalidPathException | NotFoundException $e) {
}
$command = str_replace('%i', escapeshellarg($nodeID), $command);
$command = str_replace('%s', escapeshellarg((string)$nodeID), $command);
}
if (strpos($command, '%a')) {

30
tests/psalm-baseline.xml Normal file
Просмотреть файл

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
<file src="lib/BackgroundJobs/Launcher.php">
<ForbiddenCode occurrences="1">
<code>shell_exec($wrapper)</code>
</ForbiddenCode>
<UndefinedClass occurrences="1">
<code>View</code>
</UndefinedClass>
</file>
<file src="lib/Operation.php">
<ForbiddenCode occurrences="1">
<code>shell_exec('command -v ' . escapeshellarg($scriptName))</code>
</ForbiddenCode>
<MissingDependency occurrences="5">
<code>$this-&gt;rootFolder</code>
<code>$this-&gt;rootFolder</code>
<code>$this-&gt;rootFolder</code>
<code>IRootFolder</code>
<code>IRootFolder</code>
</MissingDependency>
<UndefinedClass occurrences="5">
<code>File</code>
<code>GroupFolderStorage</code>
<code>NoUserException</code>
<code>SharedStorage</code>
<code>View</code>
</UndefinedClass>
</file>
</files>