Showing 3,235 of 4,504 total issues
Function beforeController
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function beforeController($controller, $methodName) {
if ($this->reflector->hasAnnotation('PublicPage')) {
// Don't block public pages
return;
}
- 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
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$appName,
IRequest $request,
Manager $twoFactorManager,
IUserSession $userSession,
ISession $session,
Avoid deeply nested control flow statements. Open
Open
if (\substr_count((string)$_GET['search'], '@') >= 1) {
$shareWith[] = [
'label' => (string)$_GET['search'],
'value' => [
'shareType' => \OCP\Share::SHARE_TYPE_REMOTE,
Avoid deeply nested control flow statements. Open
Open
if ((!isset($_GET['itemShares'])
|| !\is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])
|| !\in_array($uid, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]))
&& $uid != OC_User::getUser()) {
$shareWith[] = [
Avoid deeply nested control flow statements. Open
Open
if (\in_array($uid, $sharedUsers)) {
continue;
}
Avoid deeply nested control flow statements. Open
Open
if (isset($contact['CLOUD'])) {
foreach ($contact['CLOUD'] as $cloudId) {
$shareWith[] = [
'label' => $contact['FN'] . ' (' . $cloudId . ')',
'value' => [
Avoid deeply nested control flow statements. Open
Open
if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) &&
\is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
$sharedGroups = $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP];
}
Avoid deeply nested control flow statements. Open
Open
if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) &&
\is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) {
$sharedUsers = $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER];
}
Consider simplifying this complex logical expression. Open
Open
if (
params.code !== undefined
&& typeof client_id === "string"
&& client_id !== ''
&& typeof client_secret === "string"
Consider simplifying this complex logical expression. Open
Open
if (
!/^focus./.test(type) || (
toElement === undefined &&
originalEvent.fromElement === undefined &&
originalEvent.relatedTarget === undefined
Consider simplifying this complex logical expression. Open
Open
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.data = options.attrs || model.toJSON(options);
}
Consider simplifying this complex logical expression. Open
Open
if ((event.ctrlKey || event.metaKey) && // Ctrl or Command (OSX)
!event.shiftKey &&
event.keyCode === 70 && // F
self.hasFilter(getCurrentApp()) && // Search is enabled
!$searchBox.is(':focus') // if searchbox is already focused do nothing (fallback to browser default)
Consider simplifying this complex logical expression. Open
Open
if (!$foundRemoteById && \substr_count($search, '@') >= 1
&& $this->offset === 0 && $this->userSearch->isSearchable($search)
// if an exact local user is found, only keep the remote entry if
// its domain does not match the trusted domains
// (if it does, it is a user whose local login domain matches the ownCloud
Consider simplifying this complex logical expression. Open
Open
if (
$mode === 'w'
|| $mode === 'w+'
|| $mode === 'wb'
|| $mode === 'wb+'
Consider simplifying this complex logical expression. Open
Open
if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
(!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) {
// add the first item to the list of grouped shares
if (!isset($result[$key]['grouped'])) {
$result[$key]['grouped'][] = $result[$key];
Consider simplifying this complex logical expression. Open
Open
if ($includeCollections && $collectionTypes && $row['item_type'] !== 'folder' && \in_array($row['item_type'], $collectionTypes)) {
if (($collectionBackend = self::getBackend($row['item_type']))
&& $collectionBackend instanceof \OCP\Share_Backend_Collection) {
// Collections can be inside collections, check if the item is a collection
if (isset($item) && $row['item_type'] == $itemType && $row[$column] == $item) {
Consider simplifying this complex logical expression. Open
Open
if (($type === 'bool' || $type === 'boolean') &&
$value === 'false' &&
(
$this->request->method === 'GET' ||
\strpos(
Function DeleteHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function DeleteHandler(endpoint, paramID, markCallback, removeCallback, undoCallback) {
Function 1
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
templates['detailsview'] = template({"1":function(container,depth0,helpers,partials,data) {
Function main
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {