XoopsModules25x/xfguestbook

View on GitHub

Showing 1,027 of 1,027 total issues

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

    $i        = 0;
Severity: Minor
Found in index.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

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

<?php
Severity: Minor
Found in index.php by phpcodesniffer

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

<?php
Severity: Minor
Found in contact.php by phpcodesniffer

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

<?php
Severity: Minor
Found in admin/upgrade.php by phpcodesniffer

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

<?php
Severity: Minor
Found in testdata/index.php by phpcodesniffer

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

<?php
Severity: Minor
Found in language/english/common.php by phpcodesniffer

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

function approve()
{
    global $msgHandler;
    $msg_count = (!empty($_POST['msg_id']) && is_array($_POST['msg_id'])) ? count($_POST['msg_id']) : 0;
    if ($msg_count > 0) {
Severity: Minor
Found in admin/main.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

Avoid deeply nested control flow statements.
Open

                            if (is_file($templateFolder . $v)) {
                                unlink($templateFolder . $v);
                            }
Severity: Major
Found in include/onupdate.php - About 45 mins to fix

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

    function badIpDel($ip_id)
    {
        global $xoopsDB;
        $ip_count = (!empty($_POST['ip_id']) && is_array($_POST['ip_id'])) ? count($_POST['ip_id']) : 0;
        if ($ip_count > 0) {
    Severity: Minor
    Found in admin/ip_manager.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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        'paths'          => [
            'dirname'    => $moduleDirName,
            'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
            'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
            'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
    Severity: Minor
    Found in config/config.php and 1 other location - About 45 mins to fix
    include/config.php on lines 25..32

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 95.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        'paths'          => [
            'dirname'    => $moduleDirName,
            'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
            'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
            'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
    Severity: Minor
    Found in include/config.php and 1 other location - About 45 mins to fix
    config/config.php on lines 27..34

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 95.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
    Severity: Minor
    Found in class/Common/SysUtility.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct($caption, $name, $value = null, $size = 1, $nullopt = false)
      Severity: Minor
      Found in class/Form/FormSelectCountry.php - About 35 mins to fix

        Method xfguestbook_search has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function xfguestbook_search($queryarray, $andor, $limit, $offset, $user_id)
        Severity: Minor
        Found in include/search.inc.php - About 35 mins to fix

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

          function countryShow()
          {
              global $action, $start, $xoopsModule, $pathIcon16;
              /** @var Helper $helper */
              $helper = Helper::getInstance();
          Severity: Minor
          Found in admin/country_manager.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 clear_tmp_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function clear_tmp_files($dir_path, $prefix = 'tmp_')
              {
                  if (!($dir = @\opendir($dir_path))) {
                      return 0;
                  }
          Severity: Minor
          Found in class/Utility.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 getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getEditor($helper = null, $options = null)
              {
                  /** @var Helper $helper */
                  if (null === $options) {
                      $options           = [];
          Severity: Minor
          Found in class/Common/SysUtility.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 insert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function insert(\XoopsObject $msg, $force = true)
              {
                  if (Message::class !== \get_class($msg)) {
                      return false;
                  }
          Severity: Minor
          Found in class/MessageHandler.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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function delete($msg_id)
          {
              global $msgHandler, $xoopsModule;
              $ok = Request::getInt('ok', 0, 'POST');
              if (1 == $ok) {
          Severity: Minor
          Found in index.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

          Method name "Utility::email_exist" is not in camel caps format
          Open

              public static function email_exist($email)
          Severity: Minor
          Found in class/Utility.php by phpcodesniffer
          Severity
          Category
          Status
          Source
          Language