librenms/librenms

View on GitHub
scripts/composer_wrapper.php

Summary

Maintainability
A
0 mins
Test Coverage

The method curl_fetch has a boolean flag argument $output, which is a certain sign of a Single Responsibility Principle violation.
Open

function curl_fetch($url, $proxy, $use_https, $output = false)
Severity: Minor
Found in scripts/composer_wrapper.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

function curl_fetch($url, $proxy, $use_https, $output = false)
{
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

Severity: Minor
Found in scripts/composer_wrapper.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

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 108 and the first side effect is on line 26.
Open

#!/usr/bin/env php
Severity: Minor
Found in scripts/composer_wrapper.php by phpcodesniffer

Avoid variables with short names like $fp. Configured minimum length is 3.
Open

        $fp = fopen($output, 'w+');
Severity: Minor
Found in scripts/composer_wrapper.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

There are no issues that match your filters.

Category
Status