librenms/librenms

View on GitHub
LibreNMS/Alert/Transport/Pagerduty.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method deliverAlert has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function deliverAlert(array $alert_data): bool
    {
        $event_action = match ($alert_data['state']) {
            AlertState::RECOVERED => 'resolve',
            AlertState::ACKNOWLEDGED => 'acknowledge',
Severity: Minor
Found in LibreNMS/Alert/Transport/Pagerduty.php - About 1 hr to fix

    Method configTemplate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function configTemplate(): array
        {
            return [
                'config' => [
                    [
    Severity: Minor
    Found in LibreNMS/Alert/Transport/Pagerduty.php - About 1 hr to fix

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 35 and the first side effect is on line 31.
      Open

      <?php

      Possible parse error: class missing opening or closing brace
      Open

      class Pagerduty extends Transport

      Possible parse error: class missing opening or closing brace
      Open

      class Pagerduty extends Transport

      Line indented incorrectly; expected 0 spaces, found 4
      Open

          protected string $name = 'PagerDuty';

      Line indented incorrectly; expected 4 spaces, found 12
      Open

                  default => 'trigger'

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              if ($res->successful()) {

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              }

      Line indented incorrectly; expected 0 spaces, found 12
      Open

                  default => $this->config['custom-url'],

      Line indented incorrectly; expected 0 spaces, found 4
      Open

          public function deliverAlert(array $alert_data): bool

      Closing brace indented incorrectly; expected 4 spaces, found 0
      Open

      }

      Space before opening parenthesis of function call prohibited
      Open

              $url = match ($this->config['region']) {

      Space before opening parenthesis of function call prohibited
      Open

              $event_action = match ($alert_data['state']) {

      There are no issues that match your filters.

      Category
      Status