mambax7/xfaq

View on GitHub

Showing 48 of 48 total issues

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

function b_xfaq_faq($options)
{
    require_once XOOPS_ROOT_PATH . '/modules/xfaq/class/faq.php';
    $myts = MyTextSanitizer::getInstance();

Severity: Minor
Found in blocks/blocks_faq.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function render()
    {
        $ret = "<div class=\"rmmenuicon\">";
        foreach ($this->_items as $k => $v) {
            $ret .= "<a href=\"" . $v['link'] . "\" title=\"" . ($v['alt'] != '' ? $v['alt'] : $v['name']) . "\">" . ($v['icon'] != '' ? "<img src=\"" . $v['icon'] . "\" alt=\"" . $v['name'] . "\"> " : '');
Severity: Minor
Found in class/menu.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

    public function delete($obj, $force = false)
    {
        if (is_array($this->keyName)) {
            $clause = [];
            for ($i = 0, $iMax = count($this->keyName); $i < $iMax; ++$i) {
Severity: Minor
Found in class/object.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 getForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getForm($action = false)
    {
        global $xoopsDB, $xoopsModuleConfig, $xoopsModule;

        if ($action === false) {
Severity: Minor
Found in class/topic.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

Avoid too many return statements within this method.
Open

        return true;
Severity: Major
Found in class/object.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return false;
    Severity: Major
    Found in class/object.php - About 30 mins to fix

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

          public static function createFolder($folder)
          {
              //        try {
              //            if (!mkdir($folder) && !is_dir($folder)) {
              //                throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
      Severity: Minor
      Found in class/utility.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

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

      function xoops_module_install_xfaq()
      {
          global $xoopsModule, $xoopsConfig;
      
          //Create directory /xfaq
      Severity: Minor
      Found in include/install.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