Showing 759 of 1,838 total issues
Function Updates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function Updates($last, $moderators)
{
/** @var \XoopsModules\Smallworld\Helper $helper */
$helper = Helper::getInstance();
$moderators = is_array($moderators) ? $moderators : [$moderators];
- Read upRead up
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
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);
- Read upRead up
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
Open
if (1 == $owner_privset['notify']) {
$mail->sendMails($data['uid_fk'], $v, 'commentToWM', null, $wc);
}
Consider simplifying this complex logical expression. Open
Open
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
Consider simplifying this complex logical expression. Open
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 );
Consider simplifying this complex logical expression. Open
Open
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
while (
(backgroundColor === "" || backgroundColor === "transparent") &&
curElem && curElem.style
Consider simplifying this complex logical expression. Open
Open
if (window.HTMLCanvasElement &&
window.HTMLCanvasElement.prototype.toBlob &&
($.type(options.maxFileSize) !== 'number' ||
file.size < options.maxFileSize) &&
(!options.fileTypes ||
Consider simplifying this complex logical expression. Open
Open
if ( ( this.options.values.length === 2 && this.options.range === true ) &&
( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
) {
newVal = otherVal;
}
Consider simplifying this complex logical expression. Open
Open
if ( tab.hasClass( "ui-state-disabled" ) ||
// tab is already loading
tab.hasClass( "ui-tabs-loading" ) ||
// can't switch durning an animation
this.running ||
Consider simplifying this complex logical expression. Open
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 ') + '-' +
Consider simplifying this complex logical expression. Open
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 ] ) {
Consider simplifying this complex logical expression. Open
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" ) ) !==
Consider simplifying this complex logical expression. Open
Open
if ( support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
Consider simplifying this complex logical expression. Open
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) || "" ) ?
Consider simplifying this complex logical expression. Open
Open
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
Consider simplifying this complex logical expression. Open
Open
if (e.lengthComputable) {
var now = +(new Date()),
total,
loaded;
if (data._time && data.progressInterval &&
Consider simplifying this complex logical expression. Open
Open
if (
inst.options.greedy
&& !inst.options.disabled
&& inst.options.scope == draggable.options.scope
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
Consider simplifying this complex logical expression. Open
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();
Consider simplifying this complex logical expression. Open
Open
if (
// ignore null and undefined values
value == null ||
// ignore functions (when does this occur?)
$.isFunction(value) ||
Consider simplifying this complex logical expression. Open
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) {