XoopsModules25x/xlanguage

View on GitHub

Showing 48 of 589 total issues

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

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

        public function getAllList()
        {
            $baseArray = $this->getAll();
    
            $extArray = $this->getAll(false);
    Severity: Minor
    Found in class/LanguageHandler.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)
        {
            if (null === $options) {
                $options           = [];
                $options['name']   = 'Editor';
    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

    Avoid too many return statements within this method.
    Open

            return $lang->getVar('lang_id');
    Severity: Major
    Found in class/LanguageHandler.php - About 30 mins to fix

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

          public static function convertItem($value, $out_charset, $in_charset)
          {
              if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                  return $value;
              }
      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_xlanguage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function xoops_module_install_xlanguage(\XoopsModule $module)
      {
          require_once \dirname(__DIR__, 3) . '/mainfile.php';
      
          $moduleDirName = \basename(\dirname(__DIR__));
      Severity: Minor
      Found in include/oninstall.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 loadSampleData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function loadSampleData()
      {
          global $xoopsConfig;
          $moduleDirName      = \basename(\dirname(__DIR__));
          $moduleDirNameUpper = mb_strtoupper($moduleDirName);
      Severity: Minor
      Found in testdata/index.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_uninstall_xlanguage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function xoops_module_uninstall_xlanguage(\XoopsModule $module)
      {
          //    return true;
      
          $moduleDirName      = \basename(\dirname(__DIR__));
      Severity: Minor
      Found in include/onuninstall.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