Showing 4,504 of 4,504 total issues
Function getStorageId
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getStorageId() {
if (!$this->storageId) {
if ($this->storage === null) {
$storage = $this->createStorage(); //FIXME: start using exceptions
if ($storage === null) {
- 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 accept
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function accept() {
/** @var \SplFileInfo $current */
$current = $this->current();
if ($current->isDir()) {
- 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
IStoragesBackendService $backendService,
DBConfigService $dbConfig,
IUserSession $userSession,
IGroupManager $groupManager,
IUserMountCache $userMountCache,
Method sendLinkShareMailFromBody
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function sendLinkShareMailFromBody($recipients, $subject, $htmlBody, $textBody, $from, $replyTo) {
Function scanChildren
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true) {
if ($reuse === -1) {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
}
$this->emit('\OC\Files\Cache\Scanner', 'scanFolder', [$path, $this->storageId]);
- 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 getMountsForUser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getMountsForUser(IUser $user, IStorageFactory $loader) {
$mounts = [];
// setUser is in UserTrait.
/* @phan-suppress-next-line PhanUndeclaredMethod */
- 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 translate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) {
Avoid deeply nested control flow statements. Open
if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
&& (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
$items[$row['id']] = $items[$id];
$switchedItems[$id] = $row['id'];
unset($items[$id]);
Function doRepair
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function doRepair(IOutput $out) {
$this->dirMimeTypeId = $this->mimeLoader->getId('httpd/unix-directory');
$this->dirMimePartId = $this->mimeLoader->getId('httpd');
if ($this->countOnly) {
- 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 getItemsSharedWithUser
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$itemType,
$user,
$format = self::FORMAT_NONE,
$parameters = null,
$limit = -1,
Avoid deeply nested control flow statements. Open
if ($item['permissions'] & ~$permissions) {
// Add to list of items that need permissions removed
$ids[] = $item['id'];
$parents[] = $item['id'];
}
Method getItemSharedWithBySource
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$itemType,
$itemSource,
$format = self::FORMAT_NONE,
$parameters = null,
$includeCollections = false,
Avoid deeply nested control flow statements. Open
if ($items[$id]['share_type'] != self::SHARE_TYPE_GROUP) {
$items[$id]['share_type'] = self::SHARE_TYPE_GROUP;
$items[$id]['share_with'] = $row['share_with'];
}
Method fixEntryParent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function fixEntryParent(IOutput $out, $storageId, $fileId, $path, $wrongParentId, $parentIdExists = false) {
Function getBackend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getBackend($itemType) {
$l = \OC::$server->getL10N('lib');
if (isset(self::$backends[$itemType])) {
return self::$backends[$itemType];
} elseif (isset(self::$backendTypes[$itemType]['class'])) {
- 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
LicenseFetcher $licenseFetcher,
MessageService $messageService,
IAppManager $appManager,
IConfig $config,
ITimeFactory $timeFactory,
Method getSharesBy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
Method getSharesBy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) {
Function resizeAndStore
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function resizeAndStore() {
$image = $this->preview;
if (!($image instanceof IImage)) {
Util::writeLog(
'core',
- 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 getShareById
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getShareById($id, $recipientId = null) {
if (!ctype_digit($id)) {
// share id is defined as a field of type integer
// if someone calls the API asking for a share id like "abc"
// then there is no point trying to query the database,
- 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"