owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function isEmpty has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isEmpty($user) {
        $view = new View('/' . $user . '/files_trashbin');
        if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
            while ($file = \readdir($dh)) {
                if (!Filesystem::isIgnoredDir($file)) {
Severity: Minor
Found in apps/files_trashbin/lib/Trashbin.php - About 35 mins 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 translateLong has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function translateLong($text, IL10N $l, array $params) {
        switch ($text) {
            case self::CREATE_TAG:
                $params[1] = $this->convertParameterToTag($params[1], $l);
                if ($this->actorIsCurrentUser($params[0])) {
Severity: Minor
Found in apps/systemtags/lib/Activity/Extension.php - About 35 mins 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 resolvePrivateLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolvePrivateLink($uid, $fileId) {
        if ($this->rootFolder->nodeExists($uid . '/files_trashbin/files/')) {
            $baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
            '@phan-var \OCP\Files\Folder $baseFolder';
            $files = $baseFolder->getById($fileId);
Severity: Minor
Found in apps/files_trashbin/lib/Trashbin.php - About 35 mins 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 changeSchema has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function changeSchema(Schema $schema, array $options) {
        $prefix = $options['tablePrefix'];

        if ($schema->hasTable("{$prefix}federated_reshares")) {
            $table = $schema->getTable("{$prefix}federated_reshares");
Severity: Minor
Found in apps/federatedfilesharing/appinfo/Migrations/Version20170804201253.php - About 35 mins 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 sql has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function sql(IDBConnection $connection) {
        $qb = $connection->getQueryBuilder();
        $qb->select('*')
            ->from('properties', 'props')
            ->setMaxResults(1);
Severity: Minor
Found in apps/dav/appinfo/Migrations/Version20170202213905.php - About 35 mins 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 deleteUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteUser($parameters) {
        // Check if user is logged in
        $currentLoggedInUser = $this->userSession->getUser();
        if ($currentLoggedInUser === null) {
            return new Result(null, API::RESPOND_UNAUTHORISED);
Severity: Minor
Found in apps/provisioning_api/lib/Users.php - About 35 mins 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 createShare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function createShare() {
        try {
            $this->ocmMiddleware->assertIncomingSharingEnabled();
            $remote = $this->request->getParam('remote', null);
            $token = $this->request->getParam('token', null);
Severity: Minor
Found in apps/federatedfilesharing/lib/Controller/RequestHandlerController.php - About 35 mins 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 addToGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function addToGroup($parameters) {
        // Check if user is logged in
        $user = $this->userSession->getUser();
        if ($user === null) {
            return new Result(null, API::RESPOND_UNAUTHORISED);
Severity: Minor
Found in apps/provisioning_api/lib/Users.php - About 35 mins 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 getUsersToNotify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getUsersToNotify() {
        if ($this->users !== null) {
            return $this->users;
        }

Severity: Minor
Found in apps/updatenotification/lib/Notification/BackgroundJob.php - About 35 mins 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 getPublicCalendars has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPublicCalendars() {
        $fields = \array_values($this->propertyMap);
        $fields[] = 'a.id';
        $fields[] = 'a.uri';
        $fields[] = 'a.synctoken';
Severity: Minor
Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 35 mins 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 getAllAffectedPrincipals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getAllAffectedPrincipals($addressBookId) {
        $targetPrincipals = [];
        $shares = $this->cardDavBackEnd->getShares($addressBookId);
        foreach ($shares as $share) {
            if ($share['{http://owncloud.org/ns}group-share']) {
Severity: Minor
Found in apps/dav/lib/CalDAV/BirthdayService.php - About 35 mins 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get() {
        //throw exception if encryption is disabled but files are still encrypted
        try {
            $viewPath = \ltrim($this->path, '/');
            if (!$this->info->isReadable() || !$this->fileView->file_exists($viewPath)) {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/File.php - About 35 mins 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 sendFileIdHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendFileIdHeader($filePath, \Sabre\DAV\INode $node = null) {
        // chunked upload handling
        if (\OC_FileChunking::isWebdavChunk()) {
            list($path, $name) = \Sabre\Uri\split($filePath);
            $info = \OC_FileChunking::decodeName($name);
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesPlugin.php - About 35 mins 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 getUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUser($parameters) {
        $userId = $parameters['userid'];

        // Check if user is logged in
        $currentLoggedInUser = $this->userSession->getUser();
Severity: Minor
Found in apps/provisioning_api/lib/Users.php - About 35 mins 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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete() {
        try {
            if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
                throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found');
            }
Severity: Minor
Found in apps/dav/lib/SystemTag/SystemTagNode.php - About 35 mins 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 getUserSubAdminGroups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUserSubAdminGroups($parameters) {
        // Check if user is logged in
        $currentLoggedInUser = $this->userSession->getUser();
        if ($currentLoggedInUser === null) {
            return new Result(null, API::RESPOND_UNAUTHORISED);
Severity: Minor
Found in apps/provisioning_api/lib/Users.php - About 35 mins 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 getACL has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getACL() {
        $acl = [
            [
                'privilege' => '{DAV:}all',
                'principal' => '{DAV:}owner',
Severity: Minor
Found in apps/dav/lib/Files/PublicFiles/SharedNodeTrait.php - About 35 mins 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 getUsersOwnCalendars has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUsersOwnCalendars($principalUri) {
        $principalUri = $this->convertPrincipal($principalUri, true);
        $fields = \array_values($this->propertyMap);
        $fields[] = 'id';
        $fields[] = 'uri';
Severity: Minor
Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 35 mins 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 getApps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getApps($parameters) {
        $apps = OC_App::listAllApps(true);
        $list = [];
        foreach ($apps as $app) {
            $list[] = $app['id'];
Severity: Minor
Found in apps/provisioning_api/lib/Apps.php - About 35 mins 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 httpPost has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function httpPost(RequestInterface $request, ResponseInterface $response) {
        $path = $request->getPath();

        // Making sure the node exists
        $node = $this->server->tree->getNodeForPath($path);
Severity: Minor
Found in apps/dav/lib/SystemTag/SystemTagPlugin.php - About 35 mins 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