XoopsModules25x/xlanguage

View on GitHub

Showing 48 of 589 total issues

Function xoops_module_update_xlanguage has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_xlanguage(\XoopsModule $module, $previousVersion = null)
{
    $moduleDirName = \basename(\dirname(__DIR__));

    $utility      = new Utility();
Severity: Minor
Found in include/onupdate.php - About 1 day 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 truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
    {
        $open_tags = [];
        if ($considerHtml) {
            // if the plain text is shorter than the maximum length, return the whole text
Severity: Minor
Found in class/Common/SysUtility.php - About 1 day 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 showSelectedLanguage has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public static function showSelectedLanguage($options = null)
    {
        require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
        if (empty($options)) {
            $options[0] = 'images'; // display style: image, text, select
Severity: Minor
Found in class/Utility.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

Method languageList has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function languageList(LanguageHandler $languageHandler)
{
    //    global $languageHandler, $xoopsModule;

    global $pathIcon16;
Severity: Major
Found in admin/main.php - About 3 hrs to fix

    Function b_xlanguage_select_show has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    function b_xlanguage_select_show($options)
    {
        global $xlanguage;
    
        $block = [];
    Severity: Minor
    Found in blocks/xlanguage_blocks.php - About 3 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 languageList has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    function languageList(LanguageHandler $languageHandler)
    {
        //    global $languageHandler, $xoopsModule;
    
        global $pathIcon16;
    Severity: Minor
    Found in admin/main.php - About 3 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 deleteDirectory has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function deleteDirectory($src)
        {
            // Only continue if user is a 'global' Admin
            if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                return false;
    Severity: Minor
    Found in class/Common/FilesManagement.php - About 3 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

    File LanguageHandler.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace XoopsModules\Xlanguage;
    
    /**
    Severity: Minor
    Found in class/LanguageHandler.php - About 2 hrs to fix

      Function checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function checkVerModule($helper, $source = 'github', $default = 'master')
          {
              $moduleDirName      = \basename(\dirname(__DIR__, 2));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
              $update             = '';
      Severity: Minor
      Found in class/Common/VersionChecks.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

      Method insert has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function insert($lang)
          {
              $val_array = [];
              if (!$lang->isDirty()) {
                  return true;
      Severity: Major
      Found in class/LanguageHandler.php - About 2 hrs to fix

        Function insert has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function insert($lang)
            {
                $val_array = [];
                if (!$lang->isDirty()) {
                    return true;
        Severity: Minor
        Found in class/LanguageHandler.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

        Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
            {
                $open_tags = [];
                if ($considerHtml) {
                    // if the plain text is shorter than the maximum length, return the whole text
        Severity: Major
        Found in class/Common/SysUtility.php - About 2 hrs to fix

          Method b_xlanguage_select_show has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function b_xlanguage_select_show($options)
          {
              global $xlanguage;
          
              $block = [];
          Severity: Major
          Found in blocks/xlanguage_blocks.php - About 2 hrs to fix

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

            function xoops_module_update_xlanguage(\XoopsModule $module, $previousVersion = null)
            {
                $moduleDirName = \basename(\dirname(__DIR__));
            
                $utility      = new Utility();
            Severity: Major
            Found in include/onupdate.php - About 2 hrs to fix

              Function cleanMultiLang has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function cleanMultiLang($text)
                  {
                      global $xoopsConfig;
                      global $xlanguage_langs;
                      $patterns = [];
              Severity: Minor
              Found in class/Utility.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 createConfig has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createConfig()
                  {
                      $file_config = \XLANGUAGE_CONFIG_FILE;
                      if (\is_file($file_config)) {
                          \unlink($file_config);
              Severity: Minor
              Found in class/LanguageHandler.php - About 1 hr to fix

                Method cleanMultiLang has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function cleanMultiLang($text)
                    {
                        global $xoopsConfig;
                        global $xlanguage_langs;
                        $patterns = [];
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

                  Method showSelectedLanguage has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function showSelectedLanguage($options = null)
                      {
                          require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
                          if (empty($options)) {
                              $options[0] = 'images'; // display style: image, text, select
                  Severity: Minor
                  Found in class/Utility.php - About 1 hr to fix

                    Method checkVerModule has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function checkVerModule($helper, $source = 'github', $default = 'master')
                        {
                            $moduleDirName      = \basename(\dirname(__DIR__, 2));
                            $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                            $update             = '';
                    Severity: Minor
                    Found in class/Common/VersionChecks.php - About 1 hr to fix

                      Function langDetect has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function langDetect($str = '', $envType = '')
                          {
                              require dirname(__DIR__) . '/include/vars.php';
                              $lang = '';
                      
                      
                      Severity: Minor
                      Found in class/Utility.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

                      Severity
                      Category
                      Status
                      Source
                      Language