Showing 4,504 of 4,504 total issues
Function list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
public function list(): array {
$mimeTypes = [];
foreach (self::$apps as $app_name => $app_info) {
if ($this->appManager->isEnabledForUser($app_info['oc_app_name'])) {
- 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 manageMountPointError
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
manageMountPointError: function (name) {
this.getMountStatus($.proxy(function (allMountStatus) {
if (allMountStatus.hasOwnProperty(name) && allMountStatus[name].status > 0 && allMountStatus[name].status < 7) {
var mountData = allMountStatus[name];
if (mountData.type === "system") {
Function _onDropOnBreadCrumb
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_onDropOnBreadCrumb: function( event, ui ) {
var self = this;
var $target = $(event.target);
if (!$target.is('.crumb')) {
$target = $target.closest('.crumb');
Function elementToFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
elementToFile: function($el){
$el = $($el);
var data = {
id: parseInt($el.attr('data-id'), 10),
name: $el.attr('data-file'),
Function getDimensions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getDimensions( elem ) {
var raw = elem[ 0 ];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
Method getMountsForUser
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
$requiredShareTypes = [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_GROUP];
$shares = $this->shareManager->getAllSharedWith($user->getUID(), $requiredShareTypes, null);
// filter out excluded shares and group shares that includes self
Method moveShareToShare
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function moveShareToShare($path) {
$userFolder = \OC::$server->getUserFolder();
// If the user folder can't be constructed (e.g. link share) just return.
if ($userFolder === null) {
Method requestSharedSecret
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function requestSharedSecret($url, $token) {
if ($this->trustedServers->isTrustedServer($url) === false) {
$this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
return ['statuscode' => Http::STATUS_FORBIDDEN];
}
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Method createSubscription
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createSubscription($principalUri, $uri, array $properties) {
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
}
Method validateUserPass
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function validateUserPass($username, $password) {
if (\trim($username) === '') {
return false;
}
if ($this->userSession->isLoggedIn() &&
Method discover
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function discover($remote) {
// Check if something is in the cache
if ($cacheData = $this->cache->get($remote)) {
return \json_decode($cacheData, true);
}
Method onReport
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function onReport($reportName, $report, $uri) {
$reportTargetNode = $this->server->tree->getNodeForPath($uri);
if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) {
return;
}
Method fopen
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function fopen($path, $mode) {
try {
$absPath = $this->absPath($path);
switch ($mode) {
case 'r':
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
if (!$maxAge) {
$output->writeln("Auto expiration is configured - expiration will be handled automatically.");
return 1;
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function execute(InputInterface $input, OutputInterface $output) {
if ($input->getOption('show-candidates')) {
$this->showCandidates($output);
return 0;
}
Method rmdir
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function rmdir($path) {
$this->log('enter: '.__FUNCTION__."($path)");
if ($this->isRootDir($path)) {
$this->log("refusing to delete \"$path\"");
Method getFavoriteFilePaths
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getFavoriteFilePaths($user) {
$tags = $this->tagManager->load('files', [], false, $user);
$favorites = $tags->getFavorites();
if (empty($favorites)) {
Method sendMail
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function sendMail(
$toaddress,
$toname,
$subject,
$mailtext,
Method assignTags
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function assignTags($objId, $objectType, $tagIds) {
if (!\is_array($tagIds)) {
$tagIds = [$tagIds];
}