sovereignbot/citadel

View on GitHub

Showing 50 of 284 total issues

Method run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $handle = fopen("/tmp/discord.db", "r+");
        flock($handle, LOCK_EX);

Severity: Minor
Found in src/Plugins/onTimer/jabberPingsTheCulture.php - About 1 hr to fix

Function run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function run()
    {
        $handle = fopen("/tmp/discord.db", "r+");
        flock($handle, LOCK_EX);

Severity: Minor
Found in src/Plugins/onTimer/jabberPingsTheCulture.php - About 55 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

Method set has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function set($userID, $name, $lastStatus, $game, $lastSeen, $lastSpoke, $lastWritten)
Severity: Major
Found in src/Lib/Users.php - About 50 mins to fix

Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function run(Message $message, Discord $discord, WebSocket $webSocket, Logger $log, &$audioStreams, Channel $channel, cURL $curl)
Severity: Major
Found in src/Plugins/onVoice/horn.php - About 50 mins to fix

Method addPlugin has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function addPlugin($type, $command, $class, $perms, $description, $usage, $timer)
Severity: Major
Found in src/Sovereign.php - About 50 mins to fix

Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function run(Message $message, Discord $discord, WebSocket $webSocket, Logger $log, &$audioStreams, Channel $channel, cURL $curl)
Severity: Major
Found in src/Plugins/onVoice/warnings.php - About 50 mins to fix

Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function run(Message $message, Discord $discord, WebSocket $webSocket, Logger $log, &$audioStreams, Channel $channel, cURL $curl)
Severity: Major
Found in src/Plugins/onVoice/reapers.php - About 50 mins to fix

Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function run()
    {
        $explode = explode(" ", $this->message->content);
        $authString = isset($explode[1]) ? $explode[1] : "";

Severity: Minor
Found in src/Plugins/onMessage/auth.php - About 45 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

Function run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

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

Severity
Category
Status
Source
Language