XoopsModules25x/userlog

View on GitHub

Showing 1,244 of 1,244 total issues

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

        foreach ($not_config['category'] as $category) {
            if (!empty($category['item_name'])) {
                $script                                                                     = is_array($category['subscribe_from']) ? implode(':', $category['subscribe_from']) : $category['subscribe_from'];
                $itemLinks[$mObj->dirname() . ':' . $script . '-' . $category['item_name']] = $mObj->dirname() . '/' . $script . '?' . $category['item_name'] . '=ITEM_ID';
            }
Severity: Major
Found in admin/stats.php and 1 other location - About 2 hrs to fix
blocks/views.php on lines 93..98

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

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

    protected function createCacheOldWay($iniContent, $actLikeNewVersion = false)
    {
        $browsers = parse_ini_string($iniContent, true, INI_SCANNER_RAW);

        if ($actLikeNewVersion) {
Severity: Major
Found in class/phpbrowscap/Browscap.php - About 2 hrs to fix

    Function getPlugins has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getPlugins($pluginName = 'system', $inactiveModules = false)
        {
            static $plugins = [];
            if (!isset($plugins[$pluginName])) {
                $plugins[$pluginName] = [];
    Severity: Minor
    Found in class/plugin/plugin.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 getSet has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getSet()
        {
            $options = '';
            // if uid setting exist in File
            $unique_uid = $this->userlog->getUser() ? $this->userlog->getUser()->getVar('uid') : 0;
    Severity: Major
    Found in class/setting.php - About 2 hrs to fix

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

          if (el.className == class_expand) {
              el.className = class_collapse;
              if (icon.nodeName == Img_tag) {
                  icon.src = src_collapse;
              }
      Severity: Major
      Found in assets/js/scripts.js and 1 other location - About 1 hr to fix
      assets/js/scripts.js on lines 44..52

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

      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

          else {
              el.className = class_expand;
              if (icon.nodeName == Img_tag) {
                  icon.src = src_expand;
              }
      Severity: Major
      Found in assets/js/scripts.js and 1 other location - About 1 hr to fix
      assets/js/scripts.js on lines 35..43

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

      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

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

          public function getSet()
          {
              $options = '';
              // if uid setting exist in File
              $unique_uid = $this->userlog->getUser() ? $this->userlog->getUser()->getVar('uid') : 0;
      Severity: Minor
      Found in class/setting.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 insertUpdate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function insertUpdate($object, $duplicate = [], $force = true)
          {
              $handler = $this->loadHandler('write');
      
              if (!$object->isDirty()) {
      Severity: Minor
      Found in class/stats.php - About 1 hr to fix

        Method _getRemoteIniFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _getRemoteIniFile($url, $path)
            {
                // local and remote file are the same, no update possible
                if ($url == $path) {
                    return false;
        Severity: Minor
        Found in class/phpbrowscap/Browscap.php - About 1 hr to fix

          Avoid excessively long variable names like $inactiveActiveRadioEle. Keep variable name length under 20.
          Open

                  $inactiveActiveRadioEle = new XoopsFormRadio(_MA_USER_LEVEL_INACTIVE . '|' . _MA_USER_LEVEL_ACTIVE, "{$eleNamePrefix}[{$i}]", $args[$i]);
          Severity: Minor
          Found in class/query.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

          Avoid excessively long variable names like $_streamContextOptions. Keep variable name length under 20.
          Open

              protected $_streamContextOptions = [];
          Severity: Minor
          Found in class/phpbrowscap/Browscap.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#longvariable

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

              public function dropField($field = null)
              {
                  if (empty($field)) {
                      return false;
                  }
          Severity: Major
          Found in class/log.php and 2 other locations - About 1 hr to fix
          class/log.php on lines 1369..1385
          class/stats.php on lines 524..540

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

          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 3 locations. Consider refactoring.
          Open

              public function dropIndex($index = null)
              {
                  if (empty($index)) {
                      return false;
                  }
          Severity: Major
          Found in class/log.php and 2 other locations - About 1 hr to fix
          class/log.php on lines 1277..1293
          class/stats.php on lines 524..540

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

          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 3 locations. Consider refactoring.
          Open

              public function dropIndex($index = null)
              {
                  if (empty($index)) {
                      return false;
                  }
          Severity: Major
          Found in class/stats.php and 2 other locations - About 1 hr to fix
          class/log.php on lines 1277..1293
          class/log.php on lines 1369..1385

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

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

              public function updateCache()
              {
                  $lockfile = $this->cacheDir . 'cache.lock';
          
                  $lockRes = fopen($lockfile, 'w+');
          Severity: Minor
          Found in class/phpbrowscap/Browscap.php - About 1 hr to fix

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

                public function getOptions($option = null, $V = 'value')
                {
                    $V = strtolower($V);
            
                    if ($this->userlog->getUser()) {
            Severity: Minor
            Found in class/setting.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

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

                public function storeDb($tolog, $force = true)
                {
                    // set vars
                    foreach ($tolog as $option => $logvalue) {
                        if (!empty($logvalue)) {
            Severity: Minor
            Found in class/log.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 storeFile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function storeFile($tolog)
                {
                    $log_file = $this->userlog->getWorkingFile();
                    // file create/open/write
                    $fileHandler = XoopsFile::getHandler();
            Severity: Minor
            Found in class/log.php - About 1 hr to fix

              The class Browscap has 22 fields. Consider redesigning Browscap to keep the number of fields under 15.
              Open

              class Browscap
              {
                  /**
                   * Current version of the class.
                   */
              Severity: Minor
              Found in class/phpbrowscap/Browscap.php by phpmd

              TooManyFields

              Since: 0.1

              Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

              Example

              class Person {
                 protected $one;
                 private $two;
                 private $three;
                 [... many more fields ...]
              }

              Source https://phpmd.org/rules/codesize.html#toomanyfields

              Method loginregHistoryForm has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function loginregHistoryForm($args, $eleNamePrefix = 'options')
                  {
                      // require_once XOOPS_ROOT_PATH . "/class/blockform.php"; //reserve for 2.6
                      xoops_load('XoopsFormLoader');
                      // $form = new XoopsBlockForm(); //reserve for 2.6
              Severity: Minor
              Found in class/query.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language