Showing 3,235 of 4,504 total issues
Method showFile
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showFile($fileId, $details = null) {
$uid = $this->userSession->getUser()->getUID();
$baseFolder = $this->rootFolder->get($uid . '/files/');
'@phan-var \OCP\Files\Folder $baseFolder';
$files = $baseFolder->getById($fileId);
Method __construct
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
$globalPrefix,
ILogger $logger,
$localCacheClass = null,
$distributedCacheClass = null,
Method hasUpdated
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hasUpdated($path, $time) {
$this->init();
$path = $this->cleanPath($path);
try {
// force refresh for $path
Method getThumbnail
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
$stream = $file->fopen('r');
$content = \stream_get_contents($stream, 2048);
\fclose($stream);
Method getAllSharedWith
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllSharedWith($userId, $node) {
// Create array of sharedWith objects (target user -> $userId or group of which user is a member
$user = $this->userManager->get($userId);
// Check if user is member of some groups and chunk them
Method createConnectionParams
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createConnectionParams() {
$type = $this->config->getValue('dbtype', 'sqlite');
$connectionParams = [
'user' => $this->config->getValue('dbuser', ''),
Function rebuildNavigation
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
rebuildNavigation: function() {
$.getJSON(OC.filePath('settings', 'ajax', 'navigationdetect.php')).done(function(response){
if(response.status === 'success'){
var idsToKeep = {};
var navEntries=response.nav_entries;
- 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 prompt
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
prompt: function (text, title, callback, modal, name, password, buttonDeclineText, buttonConfirmText) {
return $.when(this._getMessageTemplate()).then(function ($tmpl) {
var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
var dialogId = '#' + dialogName;
var $dlg = $tmpl.octemplate({
- 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 testRemoteUrl
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function testRemoteUrl(IClientService $clientService, string $remote) {
$parsed_host = parse_url($remote, PHP_URL_HOST);
$parsed_port = parse_url($remote, PHP_URL_PORT);
if (\is_string($parsed_host)) {
$remote = $parsed_host;
- 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 checkStorageAvailability
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function checkStorageAvailability() {
// WARNING: Disabling this setting is recommended only in tightly integrated federated setups as temporarly setting,
// should NOT be used in decentralized federation setup. It could cause bad user experience when dealing
// with deleted external shares
// NOTE: This allows administrator to disable cleanup of invalid shares so only manual removal by user or admin is possible,
- 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 updateShareState
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function updateShareState($id, $state) {
$eventName = '';
if ($state === Share::STATE_ACCEPTED) {
$eventName = 'accept';
} elseif ($state === 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 copy_recursive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function copy_recursive($source, $destination, View $view) {
$size = 0;
if ($view->is_dir($source)) {
$view->mkdir($destination);
$view->touch($destination, $view->filemtime($source));
- 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 expireTrash
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function expireTrash(string $uid) {
$trashBinSize = Trashbin::getTrashbinSize($uid);
$availableSpace = $this->quota->calculateFreeSpace($trashBinSize, $uid);
// delete all files older then $retention_obligation
- 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 getCalendarsForUser
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getCalendarsForUser($principalUri) {
$principalUriOriginal = $principalUri;
$principalUri = $this->convertPrincipal($principalUri, true);
$fields = \array_values($this->propertyMap);
$fields[] = 'id';
- 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 getChild
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getChild($name) {
// Special nodes
if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) {
return new Inbox($this->caldavBackend, $this->principalInfo['uri']);
}
- 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 httpGet
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function httpGet(RequestInterface $request, ResponseInterface $response) {
// Only handle valid files
$node = $this->tree->getNodeForPath($request->getPath());
if (!($node instanceof IFile)) {
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 parseRetentionObligation
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function parseRetentionObligation() {
$splitValues = \explode(',', $this->retentionObligation);
if (!isset($splitValues[0])) {
$minValue = 'auto';
} 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 renameOrCopy
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function renameOrCopy($sourcePath, $targetPath, $operation) {
list($sourceOwner, $sourcePath) = self::getSourcePathAndUser($sourcePath);
// it was a upload of a existing file if no old path exists
// in this case the pre-hook already called the store method and we can
- 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 pixelArrayToImage
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function pixelArrayToImage() {
$x = 0;
$y = 0;
foreach ($this->pixelArray as $pixelRow) {
foreach ($pixelRow as $column) {
- 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 14 arguments (exceeds 4 allowed). Consider refactoring. Open
IL10N $l,
IAppManager $appManager,
IUserSession $userSession,
ILogger $logger,
IGroupManager $groupManager,