XoopsModules25x/userlog

View on GitHub

Showing 1,244 of 1,244 total issues

File log.php has 961 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Major
Found in class/log.php - About 2 days to fix

    Function getLogsFromFiles has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getLogsFromFiles(
            $log_files = [],
            $limit = 0,
            $start = 0,
            $options = null,
    Severity: Minor
    Found in class/log.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 Browscap.php has 825 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace phpbrowscap;
    
    use Exception as BaseException;
    Severity: Major
    Found in class/phpbrowscap/Browscap.php - About 1 day to fix

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

          public function renameFile($log_file = null, $newFileName = null)
          {
              if (!is_string($log_file)) {
                  $this->setErrors(_AM_USERLOG_FILE_SELECT_ONE);
      
      
      Severity: Major
      Found in class/log.php and 1 other location - About 1 day to fix
      class/log.php on lines 829..865

      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 289.

      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

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

          public function copyFile($log_file = null, $newFileName = null)
          {
              if (!is_string($log_file)) {
                  $this->setErrors(_AM_USERLOG_FILE_SELECT_ONE);
      
      
      Severity: Major
      Found in class/log.php and 1 other location - About 1 day to fix
      class/log.php on lines 785..821

      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 289.

      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 getOptions has 227 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getOptions($option = null, $V = 'value')
          {
              $V = strtolower($V);
      
              if ($this->userlog->getUser()) {
      Severity: Major
      Found in class/setting.php - About 1 day to fix

        Function validate has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
        Open

        function validate(elName, elType, prevent, disablecat, elMsg) {
            var i = 0;
            var el = document.getElementsByName(elName);
            var is_valid = true;
            switch (elType) {
        Severity: Minor
        Found in assets/js/scripts.js - About 7 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 getBrowser has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getBrowser($user_agent = null, $return_array = false)
            {
                if ($this->shouldCacheBeUpdated()) {
                    try {
                        $this->updateCache();
        Severity: Minor
        Found in class/phpbrowscap/Browscap.php - About 7 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 setting.php has 449 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*
         You may not change or alter any portion of this comment or credits
         of supporting developers from this source code or any supporting source code
         which is considered copyrighted (c) material of the original comment or credit authors.
        Severity: Minor
        Found in class/setting.php - About 6 hrs to fix

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

              public function addIndex($index = null, $fields = [], $index_type = 'INDEX')
              {
                  if (empty($index) || empty($fields)) {
                      return false;
                  }
          Severity: Major
          Found in class/log.php and 1 other location - About 6 hrs to fix
          class/stats.php on lines 491..512

          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 215.

          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

              public function addIndex($index = null, $fields = [], $index_type = 'INDEX')
              {
                  if (empty($index) || empty($fields)) {
                      return false;
                  }
          Severity: Major
          Found in class/stats.php and 1 other location - About 6 hrs to fix
          class/log.php on lines 1336..1357

          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 215.

          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

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

                  foreach ($options_views as $key => $item) {
                      $module_script_item = explode('-', $item); // news:article.php-storyid news:index.php-storytopic => $module["news"]=array("storyid","storytopic");
                      $module_script      = explode(':', $module_script_item[0]); //  news:article.php => $module_script = array(news,article.php);
                      if (!isset($module[$module_script[0]])) {
                          $module[$module_script[0]]['item_name'] = [];
          Severity: Major
          Found in blocks/views.php and 1 other location - About 5 hrs to fix
          admin/stats.php on lines 158..167

          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 195.

          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

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

          foreach ($moduleScriptItem as $key => $item) {
              $module_script_item = explode('-', $item); // news:article.php-storyid news:index.php-storytopic => $module["news"]=array("storyid","storytopic");
              $module_script      = explode(':', $module_script_item[0]); //  news:article.php => $module_script = array(news,article.php);
              if (!isset($module[$module_script[0]])) {
                  $module[$module_script[0]]['item_name'] = [];
          Severity: Major
          Found in admin/stats.php and 1 other location - About 5 hrs to fix
          blocks/views.php on lines 50..59

          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 195.

          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

          File xoops_version.php has 384 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*
           You may not change or alter any portion of this comment or credits
           of supporting developers from this source code or any supporting source code
           which is considered copyrighted (c) material of the original comment or credit authors.
          Severity: Minor
          Found in xoops_version.php - About 5 hrs to fix

            Function getViews has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getViews(
                    $limit = 10,
                    $start = 0,
                    $sort = 'count',
                    $order = 'DESC',
            Severity: Minor
            Found in class/log.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

            File stats.php has 367 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*
             You may not change or alter any portion of this comment or credits
             of supporting developers from this source code or any supporting source code
             which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Minor
            Found in class/stats.php - About 4 hrs to fix

              Function getLogsCounts has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getLogsCounts($criteria = null, $fields = null, $asObject = true, $id_as_key = true)
                  {
                      if (is_array($fields) && count($fields) > 0) {
                          if (!in_array($this->keyName, $fields)) {
                              $fields[] = $this->keyName;
              Severity: Minor
              Found in class/log.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

              Function updateAll has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function updateAll($type = 'log', $prob = 11)
                  {
                      if (!$this->userlog->probCheck($prob)) {
                          return false;
                      }
              Severity: Minor
              Found in class/stats.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 getLogsFromFiles has 106 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getLogsFromFiles(
                      $log_files = [],
                      $limit = 0,
                      $start = 0,
                      $options = null,
              Severity: Major
              Found in class/log.php - About 4 hrs to fix

                Function createCacheNewWay has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function createCacheNewWay($iniContent)
                    {
                        $patternPositions = [];
                
                        // get all patterns from the ini file in the correct order,
                Severity: Minor
                Found in class/phpbrowscap/Browscap.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

                Severity
                Category
                Status
                Source
                Language