owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Method __construct has 18 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $appName,
        IRequest $request,
        IUserManager $userManager,
        IGroupManager $groupManager,
        Session $userSession,
Severity: Major
Found in settings/Controller/UsersController.php - About 2 hrs to fix

    Function isUsedTlsLibOutdated has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function isUsedTlsLibOutdated(): string {
            // Don't run check when:
            // 1. Server has `has_internet_connection` set to false
            // 2. App Store AND S2S is disabled
            if (!$this->config->getSystemValue('has_internet_connection', true)) {
    Severity: Minor
    Found in settings/Controller/CheckSetupController.php - About 2 hrs 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 eatOldLicense has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function eatOldLicense($source) {
            $lines = \explode(PHP_EOL, $source);
            while (!empty($lines)) {
                $line = $lines[0];
                if (\strpos($line, '<?php') !== false) {
    Severity: Minor
    Found in build/license.php - About 2 hrs 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 getShareFolder has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getShareFolder($view = null) {
            if ($view === null) {
                $view = Filesystem::getView();
            }
            // for guests we default to root as their home storage is read-only
    Severity: Minor
    Found in apps/files_sharing/lib/Helper.php - About 2 hrs 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 deleteVersions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function deleteVersions(View $view, $file, $user) {
            $size = 0;
            if (\OCP\App::isEnabled('files_versions')) {
                if ($view->is_dir('files_trashbin/versions/' . $file)) {
                    $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
    Severity: Minor
    Found in apps/files_trashbin/lib/Trashbin.php - About 2 hrs 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 tryHttpPostToShareEndpoint has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $useOcm = false) {
            $client = $this->httpClientService->newClient();
            $protocol = 'https://';
            $result = [
                'success' => false,
    Severity: Minor
    Found in apps/federatedfilesharing/lib/Notifications.php - About 2 hrs 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 httpGet has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function httpGet(RequestInterface $request, ResponseInterface $response) {
            $queryParams = $request->getQueryParameters();
            if (!\array_key_exists('preview', $queryParams)) {
                return true;
            }
    Severity: Minor
    Found in apps/dav/lib/Files/PreviewPlugin.php - About 2 hrs 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 validateUserPass has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function validateUserPass($username, $password) {
            try {
                $share = $this->shareManager->getShareByToken($username);
            } catch (ShareNotFound $e) {
                \OC::$server->getLogger()->error("PublicAuth: share for found $username");
    Severity: Minor
    Found in apps/dav/lib/Connector/PublicAuth.php - About 2 hrs 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 xmlSerialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function xmlSerialize(Writer $writer) {
            $cs = '{' . Plugin::NS_OWNCLOUD . '}';
    
            if ($this->organizer !== null) {
                $writer->startElement($cs . 'organizer');
    Severity: Minor
    Found in apps/dav/lib/DAV/Sharing/Xml/Invite.php - About 2 hrs 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 execute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output): int {
            $mountId = $input->getArgument('mount_id');
            try {
                $mount = $this->globalService->getStorage($mountId);
            } catch (NotFoundException $e) {
    Severity: Minor
    Found in apps/files_external/lib/Command/Applicable.php - About 2 hrs 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 execute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output): int {
            $user = $input->getOption('user');
            $mountPoint = $input->getArgument('mount_point');
            $storageIdentifier = $input->getArgument('storage_backend');
            $authIdentifier = $input->getArgument('authentication_backend');
    Severity: Minor
    Found in apps/files_external/lib/Command/Create.php - About 2 hrs 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 createFile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createFile($name, $data = null) {
            # the check here is necessary, because createFile uses put covered in sabre/file.php
            # and not touch covered in files/view.php
            if (Filesystem::isForbiddenFileOrDir($name)) {
                throw new SabreForbidden();
    Severity: Minor
    Found in apps/dav/lib/Connector/Sabre/Directory.php - About 2 hrs 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 run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function run(IOutput $out) {
            if (!$this->config->getSystemValue('installed', false)) {
                // Skip the migration for new installations -> nothing to migrate
                return;
            }
    Severity: Minor
    Found in apps/files_external/appinfo/Migrations/Version20220329110116.php - About 2 hrs 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 fopen has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fopen($path, $mode) {
            $this->log('enter: '.__FUNCTION__."($path, $mode)");
            $fullPath = $this->buildPath($path);
            $result = false;
            try {
    Severity: Minor
    Found in apps/files_external/lib/Lib/Storage/SMB.php - About 2 hrs 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 rmdir has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function rmdir($path) {
            if (!$this->isDeletable($path)) {
                return false;
            }
            if (\trim($path, '/') === '') {
    Severity: Minor
    Found in apps/files_external/lib/Lib/Storage/Google.php - About 2 hrs 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 getGroupObject has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getGroupObject($gid, $displayName = null) {
            $backends = [];
            foreach ($this->backends as $backend) {
                if ($backend->groupExists($gid)) {
                    if ($backend->implementsActions(\OC\Group\Backend::GROUP_DETAILS)) {
    Severity: Minor
    Found in lib/private/Group/Manager.php - About 2 hrs 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 getUserIdGroups has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getUserIdGroups($uid, $scope = null) {
            if (!isset($this->cachedUserGroups[$uid])) {
                $groups = [];
    
                foreach ($this->backends as $backend) {
    Severity: Minor
    Found in lib/private/Group/Manager.php - About 2 hrs 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 copyFromStorage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) {
            if ($sourceStorage === $this) {
                return $this->copy($sourceInternalPath, $targetInternalPath);
            }
    
    
    Severity: Minor
    Found in lib/private/Files/Storage/Common.php - About 2 hrs 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 touch has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function touch($path, $mtime = null) {
            $this->init();
            if ($mtime === null) {
                $mtime = \OC::$server->getTimeFactory()->getTime();
            }
    Severity: Minor
    Found in lib/private/Files/Storage/DAV.php - About 2 hrs 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 extractMp4CoverArtwork has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function extractMp4CoverArtwork($absPath) {
            if (isset($this->noArtworkIndex[$absPath])) {
                return false;
            }
    
    
    Severity: Minor
    Found in lib/private/Preview/Movie.php - About 2 hrs 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