sovereignbot/citadel

View on GitHub

Showing 284 of 284 total issues

Missing class import via use statement (line '161', column '31').
Open

            $this->pool = new \Pool(count($this->onMessage), \Worker::class);
Severity: Minor
Found in src/Sovereign.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

Missing class import via use statement (line '91', column '45').
Open

        $data = json_decode(json_encode(new \SimpleXMLElement($this->curl->get("http://api.wolframalpha.com/v2/query?appid={$appID}&input={$query}"))), true);
Severity: Minor
Found in src/Plugins/onMessage/wolf.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

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

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        unset($explode[0]);
        $name = implode(" ", $explode);
Severity: Minor
Found in src/Plugins/onMessage/corp.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

Missing class import via use statement (line '39', column '49').
Open

        $container->get('log')->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::INFO));
Severity: Minor
Found in src/Service/SystemServiceProvider.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Missing class import via use statement (line '162', column '33').
Open

            $this->timers = new \Pool(count($this->onTimer), \Worker::class);
Severity: Minor
Found in src/Sovereign.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Missing class import via use statement (line '117', column '29').
Open

        $this->timers = new \Pool(count($this->onTimer), \Worker::class);
Severity: Minor
Found in src/Sovereign.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    public function run()
    {
        $pornConfig = @$this->channelConfig->porn;

        // This is one of those plugins that need to be allowed before it works
Severity: Minor
Found in src/Plugins/onMessage/porn.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

Function set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function set($userID, $name, $lastStatus, $game, $lastSeen, $lastSpoke, $lastWritten)
    {
        try {
            if (isset($lastStatus)) {
                $this->db->execute("INSERT INTO users (discordID, nickName, lastStatus) VALUES (:discordID, :nickName, :lastStatus) ON DUPLICATE KEY UPDATE lastStatus = :lastStatus", [":discordID" => $userID, ":nickName" => $name, ":lastStatus" => $lastStatus]);
Severity: Minor
Found in src/Lib/Users.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

The method __construct has 12 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function __construct($message, $discord, $channelConfig, $log, $config, $db, $curl, $settings, $permissions, $serverConfig, $users, $extras)
    {
        $this->message = $message;
        $this->discord = $discord;
        $this->channelConfig = $channelConfig;
Severity: Minor
Found in src/Plugins/onMessage/about.php by phpmd

The method connect() contains an exit expression.
Open

            die();
Severity: Minor
Found in src/Lib/Db.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

The method __construct has 12 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function __construct($message, $discord, $channelConfig, $log, $config, $db, $curl, $settings, $permissions, $serverConfig, $users, $extras)
    {
        $this->message = $message;
        $this->discord = $discord;
        $this->channelConfig = $channelConfig;
Severity: Minor
Found in src/Plugins/onMessage/auth.php by phpmd

The method query() contains an exit expression.
Open

                die(1);
Severity: Minor
Found in src/Lib/Db.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

The method __construct has 12 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function __construct($message, $discord, $channelConfig, $log, $config, $db, $curl, $settings, $permissions, $serverConfig, $users, $extras)
    {
        $this->message = $message;
        $this->discord = $discord;
        $this->channelConfig = $channelConfig;
Severity: Minor
Found in src/Plugins/onMessage/char.php by phpmd

The method __construct has 10 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function __construct($message, $discord, $log, $config, $db, $curl, $settings, $permissions, $serverConfig, $users)
    {
        $this->message = $message;
        $this->discord = $discord;
        $this->log = $log;
Severity: Minor
Found in src/Plugins/onMessage/cleverbot.php by phpmd
Severity
Category
Status
Source
Language