librenms/librenms

View on GitHub
LibreNMS/OS/Shared/Fortinet.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method getHardwareName has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getHardwareName()
    {
        $rewrite_fortinet_hardware = [
            '.1.3.6.1.4.1.12356.112.100.1' => 'FortiADC Unknown',
            '.1.3.6.1.4.1.12356.112.100.10' => 'FortiADC DEV',
Severity: Major
Found in LibreNMS/OS/Shared/Fortinet.php - About 4 hrs to fix

    The method getHardwareName() has 125 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        protected function getHardwareName()
        {
            $rewrite_fortinet_hardware = [
                '.1.3.6.1.4.1.12356.112.100.1' => 'FortiADC Unknown',
                '.1.3.6.1.4.1.12356.112.100.10' => 'FortiADC DEV',
    Severity: Minor
    Found in LibreNMS/OS/Shared/Fortinet.php by phpmd

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

            $rewrite_fortinet_hardware = [
    Severity: Minor
    Found in LibreNMS/OS/Shared/Fortinet.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