librenms/librenms

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

Summary

Maintainability
A
2 hrs
Test Coverage

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

    public function deliverAlert(array $alert_data): bool
    {
        $added_fields = $this->parseUserOptions($this->config['options']);

        $discord_title = '#' . $alert_data['uid'] . ' ' . $alert_data['title'];
Severity: Minor
Found in LibreNMS/Alert/Transport/Discord.php - About 1 hr to fix

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

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

      Avoid excessively long variable names like $embedFieldTranslations. Keep variable name length under 20.
      Open

          private array $embedFieldTranslations = [
              'name' => 'Rule Name',
          ];
      Severity: Minor
      Found in LibreNMS/Alert/Transport/Discord.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      There are no issues that match your filters.

      Category
      Status