Skip to content

Commit 850b8de

Browse files
committed
fix code smells and set baseline
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
1 parent 5610895 commit 850b8de

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

lib/Operation.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
use OCP\WorkflowEngine\IRuleMatcher;
5252
use OCP\WorkflowEngine\ISpecificOperation;
5353
use Psr\Log\LoggerInterface;
54-
use Symfony\Component\EventDispatcher\GenericEvent as LegacyGenericEvent;
5554
use UnexpectedValueException;
5655

5756
class Operation implements ISpecificOperation {
@@ -120,7 +119,6 @@ public function isAvailableForScope(int $scope): bool {
120119

121120
public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatcher): void {
122121
if (!$event instanceof GenericEvent
123-
&& !$event instanceof LegacyGenericEvent
124122
&& !$event instanceof MapperEvent) {
125123
return;
126124
}
@@ -218,7 +216,7 @@ protected function buildCommand(string $template, Node $node, string $event, arr
218216
$nodeID = $node->getId();
219217
} catch (InvalidPathException | NotFoundException $e) {
220218
}
221-
$command = str_replace('%i', escapeshellarg($nodeID), $command);
219+
$command = str_replace('%s', escapeshellarg((string)$nodeID), $command);
222220
}
223221

224222
if (strpos($command, '%a')) {

tests/psalm-baseline.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
3+
<file src="lib/BackgroundJobs/Launcher.php">
4+
<ForbiddenCode occurrences="1">
5+
<code>shell_exec($wrapper)</code>
6+
</ForbiddenCode>
7+
<UndefinedClass occurrences="1">
8+
<code>View</code>
9+
</UndefinedClass>
10+
</file>
11+
<file src="lib/Operation.php">
12+
<ForbiddenCode occurrences="1">
13+
<code>shell_exec('command -v ' . escapeshellarg($scriptName))</code>
14+
</ForbiddenCode>
15+
<MissingDependency occurrences="5">
16+
<code>$this-&gt;rootFolder</code>
17+
<code>$this-&gt;rootFolder</code>
18+
<code>$this-&gt;rootFolder</code>
19+
<code>IRootFolder</code>
20+
<code>IRootFolder</code>
21+
</MissingDependency>
22+
<UndefinedClass occurrences="5">
23+
<code>File</code>
24+
<code>GroupFolderStorage</code>
25+
<code>NoUserException</code>
26+
<code>SharedStorage</code>
27+
<code>View</code>
28+
</UndefinedClass>
29+
</file>
30+
</files>

0 commit comments

Comments
 (0)