mambax7/moduleinstaller

View on GitHub

Showing 200 of 200 total issues

Method getServerStats has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getServerStats()
    {
        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Severity: Minor
Found in class/Common/ServerStats.php - About 1 hr to fix

    Function addMethods has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function addMethods(source) {
            var ancestor = this.superclass && this.superclass.prototype,
                properties = Object.keys(source);
    
            if (IS_DONTENUM_BUGGY) {
    Severity: Minor
    Found in assets/js/prototype.js - About 1 hr to fix

      Function rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function rrmdir($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 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 respondToReadyState has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          respondToReadyState: function (readyState) {
              var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
      
              if (state == 'Complete') {
                  try {
      Severity: Minor
      Found in assets/js/prototype.js - 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 checkAccess has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function checkAccess()
          {
              if (INSTALL_USER != '' && INSTALL_PASSWORD != '') {
                  if (!isset($_SERVER['PHP_AUTH_USER'])) {
                      \header('WWW-Authenticate: Basic realm="XOOPS Installer"');
      Severity: Minor
      Found in class/InstallWizard.php - About 1 hr to fix

        Method xoops_module_install_moduleinstaller has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_install_moduleinstaller(\XoopsModule $module)
        {
            require_once \dirname(__DIR__, 3) . '/mainfile.php';
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/oninstall.php - About 1 hr to fix

          Method loadTableFromArrayWithReplace has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function loadTableFromArrayWithReplace($table, $data, $search, $replace)
          {
              /** @var \XoopsMySQLDatabase $db */
              $db = \XoopsDatabaseFactory::getDatabaseConnection();
          
          
          Severity: Minor
          Found in testdata/index.php - About 1 hr to fix

            Function Selector has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Prototype.Selector = (function () {
            
                function select() {
                    throw new Error('Method "Prototype.Selector.select" must be defined.');
                }
            Severity: Minor
            Found in assets/js/prototype.js - About 1 hr to fix

              Function request has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  request: function (url) {
                      this.url = url;
                      this.method = this.options.method;
                      var params = Object.isString(this.options.parameters) ?
                          this.options.parameters :
              Severity: Minor
              Found in assets/js/prototype.js - About 1 hr to fix

                Function replace_IE has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function replace_IE(element, content) {
                        element = $(element);
                        if (content && content.toElement)
                            content = content.toElement();
                        if (Object.isElement(content)) {
                Severity: Minor
                Found in assets/js/prototype.js - About 1 hr to fix

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

                  Form.Element.Observer = Class.create(Abstract.TimedObserver, {
                      getValue: function () {
                          return Form.Element.getValue(this.element);
                      }
                  });
                  Severity: Major
                  Found in assets/js/prototype.js and 1 other location - About 1 hr to fix
                  assets/js/prototype.js on lines 6749..6753

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

                  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

                  Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
                      getValue: function () {
                          return Form.Element.getValue(this.element);
                      }
                  });
                  Severity: Major
                  Found in assets/js/prototype.js and 1 other location - About 1 hr to fix
                  assets/js/prototype.js on lines 6696..6700

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

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

                  function xoops_module_deactivate($mid)
                  {
                      $msgs = [];
                      global $xoopsConfig;
                      // Get module handler
                  Severity: Minor
                  Found in extras/modulesadmin.php - About 1 hr to fix

                    Method loadSampleData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function loadSampleData(): void
                    {
                        global $xoopsConfig;
                        $moduleDirName      = \basename(\dirname(__DIR__));
                        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                    Severity: Minor
                    Found in testdata/index.php - About 1 hr to fix

                      Function getElementsByClassName has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      if (!document.getElementsByClassName) document.getElementsByClassName = function (instanceMethods) {
                          function iter(name) {
                              return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
                          }
                      
                      
                      Severity: Minor
                      Found in assets/js/prototype.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
                                        support.getById && context.nodeType === 9 && documentIsHTML &&
                                        Expr.relative[tokens[1].type]) {
                        
                                        context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
                        Severity: Major
                        Found in assets/js/prototype.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if (element && isPercentage) {
                                      context = context || element.parentNode;
                                      var decimal = toDecimal(value), whole = null;
                          
                                      var isHorizontal = property.include('left') || property.include('right') ||
                          Severity: Major
                          Found in assets/js/prototype.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (element === document.body) {
                                            var bodyScrollNode = document.documentElement || document.body.parentNode || document.body;
                                            valueT += !Object.isUndefined(window.pageYOffset) ? window.pageYOffset : bodyScrollNode.scrollTop || 0;
                                            valueL += !Object.isUndefined(window.pageXOffset) ? window.pageXOffset : bodyScrollNode.scrollLeft || 0;
                                            break;
                            Severity: Major
                            Found in assets/js/prototype.js - About 1 hr to fix

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

                                  if (false !== $module->getInfo('author') && '' != trim((string) $module->getInfo('author'))) {
                                      $msgs[] = '<strong>' . _AUTHOR . ':</strong> ' . htmlspecialchars(trim((string) $module->getInfo('author')), ENT_QUOTES | ENT_HTML5);
                                  }
                              Severity: Major
                              Found in extras/modulesadmin.php and 3 other locations - About 1 hr to fix
                              extras/modulesadmin.php on lines 91..93
                              extras/modulesadmin.php on lines 863..865
                              extras/modulesadmin.php on lines 1477..1479

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

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

                                  if (false !== $module->getInfo('author') && '' != trim((string) $module->getInfo('author'))) {
                                      $msgs[] = '<strong>' . _AUTHOR . ':</strong> ' . htmlspecialchars(trim((string) $module->getInfo('author')), ENT_QUOTES | ENT_HTML5);
                                  }
                              Severity: Major
                              Found in extras/modulesadmin.php and 3 other locations - About 1 hr to fix
                              extras/modulesadmin.php on lines 91..93
                              extras/modulesadmin.php on lines 649..651
                              extras/modulesadmin.php on lines 863..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 100.

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language