Skip to content

Commit 548d29f

Browse files
committed
rector and black fixes
1 parent 92bf5db commit 548d29f

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

LibreNMS/Alert/AlertNotifications.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ public function getNotificationData(Alert $alert): array|bool
235235
public function clearStaleAlerts(): void
236236
{
237237
Alert::where('state', '!=', AlertState::CLEAR)
238-
->where(function ($query) {
238+
->where(function ($query): void {
239239
$query->whereDoesntHave('device')
240240
->orWhereDoesntHave('rule');
241241
})
242242
->get()
243-
->each(function (Alert $alert) {
243+
->each(function (Alert $alert): void {
244244
echo "Stale-alert: #{$alert->id}" . PHP_EOL;
245245
$alert->delete();
246246
});
@@ -312,7 +312,7 @@ public function issueAlert(Alert $alert): bool
312312
public function runAcks(): void
313313
{
314314
$this->loadAlerts('alerts.state = ' . AlertState::ACKNOWLEDGED . ' && alerts.open = ' . AlertState::ACTIVE)
315-
->each(function (Alert $alert) {
315+
->each(function (Alert $alert): void {
316316
$rextra = $alert->rule->extra;
317317
if ($rextra['acknowledgement'] ?? true) {
318318
$this->issueAlert($alert);
@@ -329,7 +329,7 @@ public function runAcks(): void
329329
public function runFollowUp(): void
330330
{
331331
$this->loadAlerts('alerts.state > ' . AlertState::CLEAR . ' && alerts.open = 0')
332-
->each(function (Alert $alert) {
332+
->each(function (Alert $alert): void {
333333
$this->processFollowUp($alert);
334334
});
335335
}
@@ -518,7 +518,7 @@ public function loadAlerts(string $where): Collection
518518
public function runAlerts(): void
519519
{
520520
$this->loadAlerts('alerts.state != ' . AlertState::ACKNOWLEDGED . ' && alerts.open = 1')
521-
->each(function (Alert $alert) {
521+
->each(function (Alert $alert): void {
522522
$this->processAlert($alert);
523523
});
524524
}

LibreNMS/queuemanager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,12 @@ def do_work(self, context, group):
403403
logger.info("Running fast ping")
404404

405405
args = (
406-
("device:ping", "fast", "--scheduler=dispatcher", "-vv", "-g", group)
407-
if self.config.debug
408-
else ("device:ping", "fast", "--scheduler=dispatcher", "-q", "-g", group)
406+
"device:ping",
407+
"fast",
408+
"--scheduler=dispatcher",
409+
"-vv" if self.config.debug else "-q",
410+
"-g",
411+
group,
409412
)
410413
exit_code, output = LibreNMS.call_script("lnms", args)
411414

tests/Feature/AlertNotificationsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testRunAlertsSendsNotification(): void
118118
$alerts->runAlerts();
119119
$output = ob_get_clean();
120120

121-
if (strpos($output, 'Muted') !== false) {
121+
if (str_contains($output, 'Muted')) {
122122
echo "\nDEBUG OUTPUT:\n" . $output . "\n";
123123
$loaded = $alerts->loadAlerts('alerts.id = ' . $alert->id);
124124
var_dump($loaded);

0 commit comments

Comments
 (0)