XoopsModules25x/smallworld

View on GitHub

Showing 759 of 1,838 total issues

Function Updates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function Updates($last, $moderators)
    {
        /** @var \XoopsModules\Smallworld\Helper $helper */
        $helper     = Helper::getInstance();
        $moderators = is_array($moderators) ? $moderators : [$moderators];
Severity: Minor
Found in class/PublicWallUpdates.php - About 45 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 create_thumbnail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function create_thumbnail($file_name)
    {
        $file_path      = $this->upload_dir . $file_name;
        $thumbnail_path = $this->thumbnails_dir . $file_name;
        list($img_width, $img_height) = @getimagesize($file_path);
Severity: Minor
Found in class/SwUploadHandler.php - About 45 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 deeply nested control flow statements.
Open

                    if (1 == $owner_privset['notify']) {
                        $mail->sendMails($data['uid_fk'], $v, 'commentToWM', null, $wc);
                    }
Severity: Major
Found in comment_ajax.php - About 45 mins to fix

    Consider simplifying this complex logical expression.
    Open

                if (
                    inst.options.greedy &&
                    !inst.options.disabled &&
                    inst.options.scope === draggable.options.scope &&
                    inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
    Severity: Major
    Found in assets/js/jqueryui.min.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if ( o.mode === "toggle" && mode === "show" ) {
              el.from = o.to || zero;
              el.to = o.from || original;
          } else {
              el.from = o.from || ( mode === "show" ? zero : original );
      Severity: Major
      Found in assets/js/jqueryui.min.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                            if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
                                curElem = hook === "backgroundColor" ? elem.parentNode : elem;
                                while (
                                    (backgroundColor === "" || backgroundColor === "transparent") &&
                                    curElem && curElem.style
        Severity: Major
        Found in assets/js/jqueryui.min.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                          if (window.HTMLCanvasElement &&
                              window.HTMLCanvasElement.prototype.toBlob &&
                              ($.type(options.maxFileSize) !== 'number' ||
                                  file.size < options.maxFileSize) &&
                              (!options.fileTypes ||
          Severity: Major
          Found in assets/js/jquery.fileupload-fp.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if ( ( this.options.values.length === 2 && this.options.range === true ) &&
                                ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
                            ) {
                            newVal = otherVal;
                        }
            Severity: Major
            Found in assets/js/jqueryui.min.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if ( tab.hasClass( "ui-state-disabled" ) ||
                              // tab is already loading
                              tab.hasClass( "ui-tabs-loading" ) ||
                              // can't switch durning an animation
                              this.running ||
              Severity: Major
              Found in assets/js/jqueryui.min.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if (typeof icon === 'number') {
                                html += '<span title="' + title + '" ' +
                                    (settings.iconsStyle ? 'class="' + settings.iconsStyle + '" ' : '') +
                                    'style="' + (settings.iconsStyle ? 'background-position: ' :
                                    'background: transparent url(' + settings.icons + ') no-repeat ') + '-' +
                Severity: Major
                Found in assets/js/jquery.bookmark.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if ( matcher[ expando ] ) {
                                  // Find the next relative operator (if any) for proper handling
                                  j = ++i;
                                  for ( ; j < len; j++ ) {
                                      if ( Expr.relative[ tokens[j].type ] ) {
                  Severity: Major
                  Found in assets/js/jquery.min.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ( s.crossDomain == null ) {
                                parts = rurl.exec( s.url.toLowerCase() );
                                s.crossDomain = !!( parts &&
                                    ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
                                        ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
                    Severity: Major
                    Found in assets/js/jquery.min.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if ( support.matchesSelector && documentIsHTML &&
                              ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                              ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
                      
                              try {
                      Severity: Major
                      Found in assets/js/jquery.min.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                        if ( !support.opacity ) {
                            jQuery.cssHooks.opacity = {
                                get: function( elem, computed ) {
                                    // IE uses filters for opacity
                                    return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
                        Severity: Major
                        Found in assets/js/jquery.min.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
                                  return;
                              }
                          Severity: Major
                          Found in assets/js/jquery.min.js - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (e.lengthComputable) {
                                            var now = +(new Date()),
                                                total,
                                                loaded;
                                            if (data._time && data.progressInterval &&
                            Severity: Major
                            Found in assets/js/jquery.fileupload.js - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                              if (
                                                  inst.options.greedy
                                                  && !inst.options.disabled
                                                  && inst.options.scope == draggable.options.scope
                                                  && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
                              Severity: Major
                              Found in assets/js/jquery-ui-1.8.11.custom.js - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                            if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
                                                // #6694 - don't focus the input if it's already focused
                                                // this breaks the change event in IE
                                                inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
                                                inst.input.focus();
                                Severity: Major
                                Found in assets/js/jquery-ui-1.8.11.custom.js - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                              if (
                                                  // ignore null and undefined values
                                              value == null ||
                                              // ignore functions (when does this occur?)
                                              $.isFunction(value) ||
                                  Severity: Major
                                  Found in assets/js/jquery-ui-1.8.11.custom.js - About 40 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                    if (($li.hasClass("ui-tabs-selected") && !o.collapsible) ||
                                                        $li.hasClass("ui-state-disabled") ||
                                                        $li.hasClass("ui-state-processing") ||
                                                        self.panels.filter(":animated").length ||
                                                        self._trigger("select", null, self._ui(this, $show[0])) === false) {
                                    Severity: Major
                                    Found in assets/js/jquery-ui-1.8.11.custom.js - About 40 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language