Showing 4,504 of 4,504 total issues
Function checkRegexAgainstFolderOrFile
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static function checkRegexAgainstFolderOrFile($regexList, $path, $callerMessage = '') {
foreach ($regexList as $item) {
// check if the first and last character is a '/' and add one if not
// terminate with i == case insensitive
$newItem = $item;
- 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 update
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function update($id, array $data) {
unset(self::$path_cache[(int)$id]);
if (isset($data['path'])) {
// normalize path
$data['path'] = $this->normalize($data['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 getAllLegacyThemes
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getAllLegacyThemes() {
$serverRoot = $this->environmentHelper->getServerRoot();
$themes = [];
if (\is_dir($serverRoot . '/themes')) {
if ($handle = \opendir($serverRoot . '/themes')) {
- 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 fixThisShare
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function fixThisShare($groupShares, $subShares) {
if (empty($subShares)) {
return false;
}
- 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 checkLicenseFor
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function checkLicenseFor(string $appid, array $options = []): bool {
$currentTime = $this->timeFactory->getTime();
$gracePeriod = $this->config->getAppValue('core', 'grace_period', null);
if ($gracePeriod === 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 getOrCreateEntry
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getOrCreateEntry($storageId, $path, $reuseFileId = null) {
if ($path === '.') {
$path = '';
}
// find the correct parent
- 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 buildClass
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function buildClass(ReflectionClass $class) {
$constructor = $class->getConstructor();
if ($constructor === null) {
return $class->newInstance();
} 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 getRemoteAddress
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getRemoteAddress() {
$remoteAddress = $this->server['REMOTE_ADDR'] ?? '';
$trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies)) {
- 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 getStorageInfo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function getStorageInfo($path, $rootInfo = null) {
// return storage info without adding mount points
$includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false);
if (!$rootInfo) {
- 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 getDiff
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
// adjust varchar columns with a length higher then getVarcharMaxLength to clob
foreach ($targetSchema->getTables() as $table) {
foreach ($table->getColumns() as $column) {
if ($column->getType() instanceof StringType) {
- 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 call
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function call($parameters) {
$request = \OC::$server->getRequest();
$method = $request->getMethod();
// Prepare the request variables
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
public static function copyr($source, \OCP\Files\Folder $target) {
$dir = @\opendir($source);
if ($dir === false) {
throw new NoReadAccessException('No read permission for folder ' . $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 execute
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$configNames = $input->getArgument('name');
$configName = \array_shift($configNames);
$defaultValue = $input->getOption('default-value');
- 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 writeArrayInOutputFormat
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = self::DEFAULT_OUTPUT_PREFIX, $showIntKeys = false) {
switch ($input->getOption('output')) {
case self::OUTPUT_FORMAT_JSON:
$output->writeln(\json_encode($items));
break;
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
if (\OCP\Util::needUpgrade()) {
$output->writeln('Update required, skipping cron');
return 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
Method create
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(IShare $share) {
$shareWith = $share->getSharedWith();
$itemSource = $share->getNodeId();
$itemType = $share->getNodeType();
$permissions = $share->getPermissions();
Method isForbiddenFileOrDir
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
$blacklistArray = [];
$pathParts = [];
// force blacklist/exclude arraylist/arrayRegex for unit tests
Method handleChildrenMove
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleChildrenMove($sourceStorageId, $sourcePath, $targetStorageId, $targetPath) {
$platformName = $this->connection->getDatabasePlatform()->getName();
$versionString = $this->connection->getDatabaseVersionString();
$versionArray = \explode('.', $versionString);
Method getIdsForTag
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIdsForTag($tag) {
$result = null;
$tagId = false;
if (\is_numeric($tag)) {
$tagId = $tag;
Method getSupportedDatabases
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSupportedDatabases($allowAllDatabases = false) {
$availableDatabases = [
'sqlite' => [
'type' => 'class',
'call' => 'SQLite3',