owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function get($path, $ensureExists = false) {
        $path = $this->normalizePath($path);
        if ($this->isValidPath($path)) {
            $fullPath = $this->getFullPath($path);
            $virtualNode = $this->resolveVirtualNode($fullPath);
Severity: Minor
Found in lib/private/Files/Node/Root.php - About 1 hr to fix

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 searchInDir has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function searchInDir($query, $dir = '') {
        $files = [];
        $dh = $this->opendir($dir);
        if (\is_resource($dh)) {
            while (($item = \readdir($dh)) !== false) {
Severity: Minor
Found in lib/private/Files/Storage/Common.php - About 1 hr to fix

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 fromTmpFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function fromTmpFile($tmpFile, $path) {
        $this->assertPathLength($path);
        if (Filesystem::isValidPath($path)) {
            // Get directory that the file is going into
            $filePath = \dirname($path);
Severity: Minor
Found in lib/private/Files/View.php - About 1 hr to fix

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 filemtime has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function filemtime($path) {
        $fullPath = $this->getSourcePath($path);
        \clearstatcache($fullPath);
        if (!$this->file_exists($path)) {
            return false;
Severity: Minor
Found in lib/private/Files/Storage/Local.php - About 1 hr to fix

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 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(
        $globalPrefix,
        ILogger $logger,
        $localCacheClass = null,
        $distributedCacheClass = null,
Severity: Minor
Found in lib/private/Memcache/Factory.php - About 1 hr to fix

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 updateEncryptedVersion has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function updateEncryptedVersion(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename) {
        $isEncrypted = $this->encryptionManager->isEnabled() && $this->mount->getOption('encrypt', true) ? 1 : 0;
        $cacheInformation = [
            'encrypted' => (bool)$isEncrypted,
        ];
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 1 hr to fix

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 scan has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function scan($dir = '') {
        if (!Filesystem::isValidPath($dir)) {
            throw new \InvalidArgumentException('Invalid path to scan');
        }
        $mounts = $this->getMounts($dir);
Severity: Minor
Found in lib/private/Files/Utils/Scanner.php - About 1 hr to fix

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 mkdir has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function mkdir($path) {
        $path = $this->normalizePath($path);

        if ($this->file_exists($path)) {
            return false;
Severity: Minor
Found in lib/private/Files/ObjectStore/ObjectStoreStorage.php - About 1 hr to fix

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 getFontFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFontFile(array $info): string {
        $fontFileDir  = __DIR__;
        $fontFileDir .= '/../../../core/fonts/';

        $fontSet = [
Severity: Minor
Found in lib/private/Preview/TXT.php - About 1 hr to fix

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 getAppsFromMarket has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getAppsFromMarket(IOutput $output, $appList, $event) {
        $failedApps = [];
        foreach ($appList as $app) {
            $output->info("Fetching app from market: $app");
            try {
Severity: Minor
Found in lib/private/Repair/Apps.php - About 1 hr to fix

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 getAllSharesBy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares = false) {
        // This function requires at least 1 node (parent folder)
        if (empty($nodeIDs)) {
            throw new \InvalidArgumentException('Array of nodeIDs empty');
        }
Severity: Minor
Found in lib/private/Share20/Manager.php - About 1 hr to fix

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 convertAddresses has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function convertAddresses($addresses) {
        if (!\function_exists('idn_to_ascii')) {
            return $addresses;
        }

Severity: Minor
Found in lib/private/Mail/Message.php - About 1 hr to fix

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 main has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) {
        if ($urlParams !== null) {
            $container['OCP\\IRequest']->setUrlParameters($urlParams);
        } elseif (isset($container['urlParams']) && $container['urlParams'] !== null) {
            $container['OCP\\IRequest']->setUrlParameters($container['urlParams']);
Severity: Minor
Found in lib/private/AppFramework/App.php - About 1 hr to fix

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 addUseNameToBlackList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function addUseNameToBlackList($name, $alias) {
        $name = \strtolower($name);
        $alias = \strtolower($alias);

        foreach ($this->blackListedClassNames as $blackListedAlias => $blackListedClassName) {
Severity: Minor
Found in lib/private/App/CodeChecker/NodeVisitor.php - About 1 hr to fix

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 getAllApps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getAllApps() {
        $apps = [];

        foreach (OC::$APPSROOTS as $apps_dir) {
            if (!\is_readable($apps_dir['path'])) {
Severity: Minor
Found in lib/private/legacy/app.php - About 1 hr to fix

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 downloadApp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static function downloadApp($data = []) {
        $l = \OC::$server->getL10N('lib');

        if (!isset($data['source'])) {
            throw new \Exception($l->t("No source specified when installing app"));
Severity: Minor
Found in lib/private/Installer.php - About 1 hr to fix

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 decryptAllUsersFiles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function decryptAllUsersFiles($user = '') {
        $this->output->writeln("\n");

        $progress = new ProgressBar($this->output);
        $progress->setFormat(" %message% \n [%bar%]");
Severity: Minor
Found in lib/private/Encryption/DecryptAll.php - About 1 hr to fix

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 setupBackends has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setupBackends() {
        OC_App::loadApps(['prelogin']);
        $backends = \OC::$server->getSystemConfig()->getValue('user_backends', []);
        if (isset($backends['default']) && !$backends['default']) {
            // clear default backends
Severity: Minor
Found in lib/private/legacy/user.php - About 1 hr to fix

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 syncHome has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function syncHome(Account $a, UserInterface $backend) {
        // Fallback for backends that dont yet use the new interfaces
        $providesHome = $backend instanceof IProvidesHomeBackend || $backend->implementsActions(\OC_User_Backend::GET_HOME);
        $uid = $a->getUserId();
        // Log when the backend returns a string that is a different home to the current value
Severity: Minor
Found in lib/private/User/SyncService.php - About 1 hr to fix

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 search has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function search($query) {
        $files = Filesystem::search($query);
        $results = [];
        // edit results
        foreach ($files as $fileData) {
Severity: Minor
Found in lib/private/Search/Provider/File.php - About 1 hr to fix

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

Severity
Category
Status
Source
Language