Showing 4,504 of 4,504 total issues
Function transformDBResults
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function transformDBResults(&$row) {
if (isset($row['id'])) {
$row['id'] = (int) $row['id'];
}
if (isset($row['share_type'])) {
- 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 repairMimetypes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function repairMimetypes($wrongMimetypes) {
foreach ($wrongMimetypes as $wrong => $correct) {
// do we need to remove a wrong mimetype?
$result = \OC_DB::executeAudited(self::getIdStmt(), [$wrong]);
$wrongId = $result->fetchOne();
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
public function run(IOutput $out) {
if (!$this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
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 resolveGroupShares
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function resolveGroupShares($shares, $userId) {
$qb = $this->dbConn->getQueryBuilder();
list($chunkedShareIds, $shareIdToShareMap) = $this->chunkSharesToMaps($shares);
foreach ($chunkedShareIds as $shareIdsChunk) {
- 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 getRequestUri
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getRequestUri() {
$uri = $this->server['REQUEST_URI'] ?? '';
// remove too many leading slashes - can be caused by reverse proxy configuration
if (\strpos($uri, '/') === 0) {
$uri = '/' . \ltrim($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 copyr
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function copyr($src, $dest) {
if (\is_dir($src)) {
if (!\is_dir($dest)) {
\mkdir($dest);
}
- 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 buildNotExistingFileNameForView
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function buildNotExistingFileNameForView($path, $filename, \OC\Files\View $view) {
if ($path === '/') {
$path = '';
}
if ($pos = \strrpos($filename, '.')) {
- 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 isSystemWideMountPoint
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function isSystemWideMountPoint($path, $uid) {
if (\OCP\App::isEnabled("files_external")) {
$mounts = \OC\Files\External\LegacyUtil::getSystemMountPoints();
foreach ($mounts as $mount) {
if (\strpos($path, '/files/' . $mount['mountpoint']) === 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 canExecute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function canExecute($name, $path = false) {
// path defaults to PATH from environment if not set
if ($path === false) {
$path = \getenv("PATH");
}
- 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 analyzeCommands
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeCommands(array $dependencies) {
$missing = [];
if (!isset($dependencies['command'])) {
return $missing;
}
- 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 fetchPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function fetchPage($additionalParams = null) {
$data = parent::fetchPage($additionalParams);
if ($this->renderAs) {
$page = new TemplateLayout($this->renderAs, $this->app);
- 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 listCertificates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function listCertificates() {
if (!$this->config->getSystemValue('installed', false)) {
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 callForUsers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function callForUsers($callback, $search, $onlySeen, $limit = null, $offset = null) {
$qb = $this->db->getQueryBuilder();
$qb->select(['*'])
->from($this->getTableName());
- 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 changeLock
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function changeLock($path, $targetType) {
if ($targetType === self::LOCK_SHARED) {
if (!$this->hasAcquiredLock($path, self::LOCK_EXCLUSIVE)) {
// trying to change a lock that we haven't acquired -> throw exception
\OCP\Util::writeLog('core', "trying lock change to type $targetType for $path, but the lock hasn't been acquired before!!", \OCP\Util::WARN);
- 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 syncState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function syncState(Account $a) {
$uid = $a->getUserId();
list($hasKey, $value) = $this->readUserConfig($uid, 'core', 'enabled');
if ($hasKey) {
if ($value === 'true') {
- 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 getRoutingFiles
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getRoutingFiles() {
if (!isset($this->routingFiles)) {
$this->routingFiles = [];
foreach (\OC_App::getEnabledApps() as $app) {
$appPath = \OC_App::getAppPath($app);
- 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 getAppsRepairSteps
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getAppsRepairSteps(OutputInterface $output) {
$apps = $this->appManager->getEnabledAppsForUser();
$steps = [];
foreach ($apps as $app) {
try {
- 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 getAllLanguages
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getAllLanguages($path) {
$result = [];
foreach (new DirectoryIterator("$path/l10n") as $fileInfo) {
if ($fileInfo->isDot()) {
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 execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$configNames = $input->getArgument('name');
$configName = $configNames[0];
if (\sizeof($configNames) > 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 handleRepairFeedback
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function handleRepairFeedback($event) {
if (!$event instanceof GenericEvent) {
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"