librenms/librenms

View on GitHub
LibreNMS/ComposerHelper.php

Summary

Maintainability
A
1 hr
Test Coverage

Method populateEnv has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function populateEnv()
    {
        $config = [
            'db_host' => '',
            'db_port' => '',
Severity: Minor
Found in LibreNMS/ComposerHelper.php - About 1 hr to fix

    Remove error control operator '@' on line 135.
    Open

        private static function populateEnv()
        {
            $config = [
                'db_host' => '',
                'db_port' => '',
    Severity: Minor
    Found in LibreNMS/ComposerHelper.php by phpmd

    ErrorControlOperator

    Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

    Example

    function foo($filePath) {
        $file = @fopen($filPath); // hides exceptions
        $key = @$array[$notExistingKey]; // assigns null to $key
    }

    Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

    Avoid unused parameters such as '$event'.
    Open

        public static function postInstall(Event $event)
    Severity: Minor
    Found in LibreNMS/ComposerHelper.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    The method preUpdate() contains an exit expression.
    Open

                exit(1);
    Severity: Minor
    Found in LibreNMS/ComposerHelper.php by phpmd

    ExitExpression

    Since: 0.2

    An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

    Example

    class Foo {
        public function bar($param)  {
            if ($param === 42) {
                exit(23);
            }
        }
    }

    Source https://phpmd.org/rules/design.html#exitexpression

    Avoid unused parameters such as '$event'.
    Open

        public static function preInstall(Event $event)
    Severity: Minor
    Found in LibreNMS/ComposerHelper.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid unused parameters such as '$event'.
    Open

        public static function preUpdate(Event $event)
    Severity: Minor
    Found in LibreNMS/ComposerHelper.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid unused parameters such as '$event'.
    Open

        public static function postRootPackageInstall(Event $event)
    Severity: Minor
    Found in LibreNMS/ComposerHelper.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    There are no issues that match your filters.

    Category
    Status