robinp7720/Blue-Stats-Minecraft

View on GitHub

Showing 25 of 90 total issues

Function secondsToTime has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
Open

function secondsToTime ($seconds, $contract = TRUE) {
    if (!empty($seconds)) {
        $dtF = new DateTime("@0");
        $dtT = new DateTime("@$seconds");
        if ($contract) {
Severity: Minor
Found in functions/utils.func.php - About 2 days 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

File lolmewnStats.php has 914 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BlueStats\Plugin;

use BlueStats\API\plugin;
Severity: Major
Found in plugins/lolmewnStats/lolmewnStats.php - About 2 days to fix

File Statz.php has 798 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BlueStats\Plugin;

use BlueStats\API\plugin;
Severity: Major
Found in plugins/Statz/Statz.php - About 1 day to fix

File McMMO.php has 433 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BlueStats\Plugin;

use BlueStats\API\plugin;
Severity: Minor
Found in plugins/McMMO/McMMO.php - About 6 hrs to fix

Method secondsToTime has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function secondsToTime ($seconds, $contract = TRUE) {
    if (!empty($seconds)) {
        $dtF = new DateTime("@0");
        $dtT = new DateTime("@$seconds");
        if ($contract) {
Severity: Major
Found in functions/utils.func.php - About 6 hrs to fix

Function player has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function player ($player, $stat, $options = []) {
        $mysqli = $this->mysql;
        $stmt   = $mysqli->stmt_init();


Severity: Minor
Found in classes/plugin/pluginStats.php - About 5 hrs 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 tableToHTML has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function tableToHTML ($sorted = TRUE) {
        $cellsY = count($this->data);
        $cellsX = $this->biggestRow;
        $string = "<table class='table'>\n";
        if ($sorted)
Severity: Minor
Found in classes/table.class.php - About 4 hrs 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 GetStatus has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function GetStatus ($Challenge) {
        $Data = $this->WriteData(self :: STATISTIC, $Challenge . Pack('c*', 0x00, 0x00, 0x00, 0x00));
        if (!$Data) {
            throw new MinecraftQueryException('Failed to receive status.');
        }
Severity: Major
Found in plugins/query/minecraftQuery.php - About 2 hrs to fix

Method render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render ($type = "GLOBAL") {

        // Get template file to render
        $filePath = $this->viewPath . "templates/{$this->page}.html";

Severity: Major
Found in classes/view.class.php - About 2 hrs to fix

Method player has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function player ($player, $stat, $options = []) {
        $mysqli = $this->mysql;
        $stmt   = $mysqli->stmt_init();


Severity: Major
Found in classes/plugin/pluginStats.php - About 2 hrs to fix

Function GetStatus has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function GetStatus ($Challenge) {
        $Data = $this->WriteData(self :: STATISTIC, $Challenge . Pack('c*', 0x00, 0x00, 0x00, 0x00));
        if (!$Data) {
            throw new MinecraftQueryException('Failed to receive status.');
        }
Severity: Minor
Found in plugins/query/minecraftQuery.php - About 2 hrs 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 getTemplate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function getTemplate ($filePath) {
        if (file_exists($filePath)) {
            /* Load template file */
            $content = file_get_contents($filePath);

Severity: Minor
Found in classes/view.class.php - About 1 hr 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 render has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function render ($type = "GLOBAL") {

        // Get template file to render
        $filePath = $this->viewPath . "templates/{$this->page}.html";

Severity: Minor
Found in classes/view.class.php - About 1 hr 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 tableToHTML has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function tableToHTML ($sorted = TRUE) {
        $cellsY = count($this->data);
        $cellsX = $this->biggestRow;
        $string = "<table class='table'>\n";
        if ($sorted)
Severity: Minor
Found in classes/table.class.php - About 1 hr to fix

Function statList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function statList ($stat, $limit, $options = []) {
        $mysqli = $this->mysql;
        $stmt   = $mysqli->stmt_init();

        $aggregateColumn = "";
Severity: Minor
Found in classes/plugin/pluginStats.php - About 1 hr 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 sum has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function sum($stat) {
        $mysqli = $this->mysql;
        $stmt   = $mysqli->stmt_init();

        $aggregateColumn = "";
Severity: Minor
Found in classes/plugin/pluginStats.php - About 1 hr 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 statList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function statList ($stat, $limit, $options = []) {
        $mysqli = $this->mysql;
        $stmt   = $mysqli->stmt_init();

        $aggregateColumn = "";
Severity: Minor
Found in classes/plugin/pluginStats.php - About 1 hr to fix

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

    public function sum($stat) {
        $mysqli = $this->mysql;
        $stmt   = $mysqli->stmt_init();

        $aggregateColumn = "";
Severity: Minor
Found in classes/plugin/pluginStats.php - About 1 hr to fix

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

    public function set ($option, $value, $plugin = "this") {
        $value = json_encode($value);
        if ($plugin == "this")
            $plugin = $this->pluginName;
        $mysqli = $this->BlueStatsMYQLI;
Severity: Minor
Found in classes/config.class.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 reCache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function reCache ($name) {
        if ($this->config->get("enabled") == "true" && !isset($_GET["recache"])) {
            $file_name = md5($name) . '.json';
            if (file_exists($this->cache_dir . $file_name)) {
                $file  = file_get_contents($this->cache_dir . $file_name);
Severity: Minor
Found in classes/cache.class.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

Severity
Category
Status
Source
Language