Showing 3,235 of 4,504 total issues
Method shareItem
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null, $passwordChanged = null) {
Consider simplifying this complex logical expression. Open
if ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 0) {
return (string) $l->t('today');
} elseif ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 1) {
return (string) $l->t('yesterday');
} elseif ($dateInterval->y == 0 && $dateInterval->m == 0) {
Method register
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$method,
$url,
$action,
$app,
$authLevel = API::USER_AUTH,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Account $account,
AccountMapper $mapper,
$emitter = null,
IConfig $config = null,
$urlGenerator = null,
Function _parseAppAuthor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_parseAppAuthor: function (author) {
if (_.isObject(author) && !_.isUndefined(author['@value'])) {
return author['@value'];
}
- 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 _getFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_getFile: function(mimeType, files) {
var icon = mimeType.replace(new RegExp('/', 'g'), '-');
// Generate path
if (mimeType === 'dir' && $.inArray('folder', files) !== -1) {
- 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 handleException
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function handleException($e) {
$request = \OC::$server->getRequest();
// in case the request content type is text/xml - we assume it's a WebDAV request
$isXmlContentType = \strpos($request->getHeader('Content-Type') ?? '', 'text/xml');
if ($isXmlContentType === 0) {
- 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 getSharesFromItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getSharesFromItem($target) {
$result = [];
$owner = Filesystem::getOwner($target);
Filesystem::initMountPoints($owner);
$info = Filesystem::getFileInfo($target);
- 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 canAccessShare
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function canAccessShare(IShare $share) {
// A file with permissions 0 can't be accessed by us,
// unless it's a rejected sub-group share in which case we want it visible to let the user accept it again
if ($share->getPermissions() === 0
&& !($share->getShareType() === Share::SHARE_TYPE_GROUP && $share->getState() === Share::STATE_REJECTED)) {
- 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 format
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function format(INotification $notification, L10N $l) {
$params = $notification->getSubjectParameters();
if ($params[0] !== $params[1] && $params[1] !== null) {
$params[0] = $this->getUserString($params[0]);
$params[1] = $this->getUserString($params[1]);
- 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 event
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function event(ManagerEvent $event) {
$actor = $this->session->getUser();
if ($actor instanceof IUser) {
$actor = $actor->getUID();
} else {
- 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$retentionEnabled = $this->trashExpiryManager->retentionEnabled();
if (!$retentionEnabled) {
$output->writeln("Auto expiration is configured - expiration will be handled automatically.");
return 1;
- 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 validateUserPass
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function validateUserPass($username, $password) {
if (\trim($username) === '') {
return false;
}
if ($this->userSession->isLoggedIn() &&
- 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 check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function check(RequestInterface $request, ResponseInterface $response) {
$node = $this->resolveShare($request->getPath());
if (!$node instanceof PublicSharedRootNode) {
return [true, 'principals/system/public'];
}
- 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 getDavPermissions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getDavPermissions() {
$node = $this->getNode();
$p = '';
if ($node->isDeletable() && $this->checkSharePermissions(Constants::PERMISSION_DELETE)) {
$p .= 'D';
- 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 updateStorageStatus
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function updateStorageStatus(IStorageConfig &$storage, $configInput, OutputInterface $output) {
try {
try {
$this->manipulateStorageConfig($storage);
} catch (InsufficientDataForMeaningfulAnswerException $e) {
- 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 onReport
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function onReport($reportName, $report, $uri) {
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) {
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
Function handleGetProperties
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function handleGetProperties(
PropFind $propFind,
\Sabre\DAV\INode $sabreNode
) {
if (!($sabreNode instanceof \OCA\DAV\Connector\Sabre\Node)) {
- 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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function run(IOutput $out) {
if (!$this->config->getSystemValue('installed', false)) {
// Skip the migration for new installations -> nothing to migrate
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
Function updateCard
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function updateCard(VCard $vCard, IUser $user) {
$uid = $user->getUID();
$displayName = $user->getDisplayName();
$displayName = empty($displayName) ? $uid : $displayName;
$emailAddress = $user->getEMailAddress();
- 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"