owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function setMailAddress has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function setMailAddress($id, $mailAddress) {
        $userId = $this->userSession->getUser()->getUID();
        $user = $this->userManager->get($id);

        if ($userId !== $id
Severity: Minor
Found in settings/Controller/UsersController.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 fopen has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function fopen($path, $mode) {
        if ($source = $this->getSourcePath($path)) {
            switch ($mode) {
                case 'r+':
                case 'rb+':
Severity: Minor
Found in apps/files_sharing/lib/SharedStorage.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 parseRetentionObligation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function parseRetentionObligation() {
        $splitValues = \explode(',', $this->retentionObligation);
        if (!isset($splitValues[0])) {
            $minValue = self::DEFAULT_RETENTION_OBLIGATION;
        } else {
Severity: Minor
Found in apps/files_trashbin/lib/Expiration.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 prepare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare(INotification $notification, $languageCode) {
        if ($notification->getApp() !== 'files_sharing') {
            // Not my app => throw
            throw new \InvalidArgumentException();
        }
Severity: Minor
Found in apps/federatedfilesharing/lib/Notifier.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 commentEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function commentEvent(CommentsEvent $event) {
        if ($event->getComment()->getObjectType() !== 'files'
            || !\in_array($event->getEvent(), [CommentsEvent::EVENT_ADD])
            || !$this->appManager->isInstalled('activity')) {
            // Comment not for file, not adding a comment or no activity-app enabled (save the energy)
Severity: Minor
Found in apps/comments/lib/Activity/Listener.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 schedule has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function schedule(ITip\Message $iTipMessage) {
        // Not sending any emails if OC-CalDav-Import header is set
        if ($this->request->getHeader('OC-CalDav-Import') !== null) {
            return;
        }
Severity: Minor
Found in apps/dav/lib/CalDAV/Schedule/IMipPlugin.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 processNotification has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function processNotification(
        $notificationType,
        $resourceType,
        $providerId,
        $notification
Severity: Minor
Found in apps/federatedfilesharing/lib/Controller/OcmController.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 buildDateFromContact has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildDateFromContact($cardData, $dateField, $summarySymbol) {
        if (empty($cardData)) {
            return null;
        }
        try {
Severity: Minor
Found in apps/dav/lib/CalDAV/BirthdayService.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 ocmDiscover has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function ocmDiscover($remote) {
        // Check if something is in the cache
        if ($cacheData = $this->cache->get('OCM' . $remote)) {
            return \json_decode($cacheData, true);
        }
Severity: Minor
Found in apps/federatedfilesharing/lib/DiscoveryManager.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 convertToSabreException has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function convertToSabreException(\Exception $e) {
        if ($e instanceof FileContentNotAllowedException) {
            // the file content is not permitted
            throw new DAVForbiddenException($e->getMessage(), $e->getRetry(), $e);
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/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

Function loadFSApps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadFSApps() {
        $enabledApps = \OC_App::getEnabledApps();
        foreach ($enabledApps as $enabledApp) {
            if ($enabledApp !== 'files_external' && \OC_App::isType($enabledApp, ['filesystem'])) {
                try {
Severity: Minor
Found in apps/files_external/appinfo/Migrations/Version20210511082903.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 loadFSApps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadFSApps() {
        $enabledApps = \OC_App::getEnabledApps();
        foreach ($enabledApps as $enabledApp) {
            if ($enabledApp !== 'files_external' && \OC_App::isType($enabledApp, ['filesystem'])) {
                try {
Severity: Minor
Found in apps/files_external/appinfo/Migrations/Version20220329110116.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 getChild has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChild($name, $info = null) {
        if (!$this->info->isReadable()) {
            // avoid detecting files through this way
            throw new SabreNotFound();
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Directory.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 userScan has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function userScan($users, $inputPath, $shouldRepairStoragesIndividually, $input, $output, $verbose) {
        $users_total = \count($users);
        $user_count = 0;
        foreach ($users as $user) {
            if (\is_object($user)) {
Severity: Minor
Found in apps/files/lib/Command/Scan.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 getAllVersions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllVersions($uid) {
        $view = $this->getUserView($uid);
        $dirs = [self::VERSIONS_RELATIVE_PATH];
        $versions = [];

Severity: Minor
Found in apps/files_versions/lib/FileHelper.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 rmdir has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function rmdir($path) {
        if ($this->is_dir($path) && $this->isDeletable($path)) {
            $dh = $this->opendir($path);
            if (!\is_resource($dh)) {
                return false;
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/StreamWrapper.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 hasUpdated has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function hasUpdated($path, $time) {
        if ($this->is_file($path)) {
            return parent::hasUpdated($path, $time);
        }

Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.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 copy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function copy($path1, $path2) {
        if ($this->is_dir($path1)) {
            $this->remove($path2);
            $dir = $this->opendir($path1);
            $this->mkdir($path2);
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 __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($prefix = '') {
        parent::__construct($prefix);
        if (self::$cache === null) {
            self::$cache = new \Memcached();

Severity: Minor
Found in lib/private/Memcache/Memcached.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 unlink has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

        if ($stat && isset($stat['fileid'])) {
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

Severity
Category
Status
Source
Language