Showing 3,235 of 4,504 total issues
Method handleChildren
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function handleChildren($path, $recursive, $reuse, $folderId, $lock, &$size) {
Function verifyUnencryptedSize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function verifyUnencryptedSize($path, $unencryptedSize) {
$size = $this->storage->filesize($path);
$result = $unencryptedSize;
if ($unencryptedSize < 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 normalizePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
if (self::$normalizedPathCache === null) {
self::$normalizedPathCache = new CappedMemoryCache();
}
- 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 writeBack
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function writeBack($tmpFile) {
if (!isset(self::$tmpFiles[$tmpFile])) {
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 backgroundScan
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function backgroundScan($dir) {
$mounts = $this->getMounts($dir);
foreach ($mounts as $mount) {
if (!$this->shouldScan($mount)) {
continue;
- 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 formatCacheEntry
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function formatCacheEntry($entry) {
$storageId = $entry->getStorageId();
// Give all permissions to whitelisted "internal" paths and their
// subdirectories
- 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 getThumbnail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
$useFileDirectly = (!$file->isEncrypted() && !$file->isMounted());
if ($useFileDirectly) {
$absPath = $file->getStorage()->getLocalFile($file->getInternalPath());
} 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 setBackendOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setBackendOptions($backendOptions) {
if ($this->getBackend() instanceof Backend) {
$parameters = $this->getBackend()->getParameters();
foreach ($backendOptions as $key => $value) {
if (isset($parameters[$key])) {
- 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 __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null) {
if ($arguments === null) {
$arguments = [];
}
if ($loader === 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 addMultiple
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addMultiple($names, $sync=false, $id = null) {
if (!\is_array($names)) {
$names = [$names];
}
$names = \array_map('trim', $names);
- 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 tagAs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function tagAs($objid, $tag) {
if (\is_string($tag) && !\is_numeric($tag)) {
$tag = \trim($tag);
if ($tag === '') {
\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', \OCP\Util::DEBUG);
- 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 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"