owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

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

    protected function getHeader($path) {
        if (\is_resource($path)) {
            $exists = false;
        } else {
            $realFile = OC_Util::stripPartialFileExtension($path);
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 getNotificationTypes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNotificationTypes($languageCode) {
        $filesNotificationTypes = [];
        $sharingNotificationTypes = [];

        $notificationTypes = [];
Severity: Minor
Found in lib/private/Activity/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 post_deleteUser has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function post_deleteUser($arguments) {
        // Find all objectid/tagId pairs.
        $result = null;
        try {
            $stmt = \OCP\DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
Severity: Minor
Found in lib/private/Tags.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 getSharedItemsOwners has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getSharedItemsOwners($user, $type, $includeCollections = false, $includeOwner = false) {
        // First, we find out if $type is part of a collection (and if that collection is part of
        // another one and so on).
        $collectionTypes = [];
        if (!$includeCollections || !$collectionTypes = self::getCollectionItemTypes($type)) {
Severity: Minor
Found in lib/private/Share/Share.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 generateTarget has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedTarget = null, $groupParent = null) {
        // FIXME: $uidOwner and $groupParent seems to be unused
        $backend = \OC\Share\Share::getBackend($itemType);
        if ($shareType === self::SHARE_TYPE_LINK || $shareType === self::SHARE_TYPE_REMOTE) {
            if (isset($suggestedTarget)) {
Severity: Minor
Found in lib/private/Share/Helper.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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function create(\OCP\Share\IShare $share) {
        $this->validate($share);
        $qb = $this->dbConn->getQueryBuilder();

        $qb->insert('share');
Severity: Minor
Found in lib/private/Share20/DefaultShareProvider.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 getAllSharedWith has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllSharedWith($userId, $shareTypes, $node = null) {
        $shares = [];

        // Aggregate all required $shareTypes by mapping provider to supported shareTypes
        $providerIdMap = $this->shareTypeToProviderMap($shareTypes);
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 decodeContent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function decodeContent() {
        if ($this->contentDecoded) {
            return;
        }
        $params = [];
Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 getRawPathInfo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRawPathInfo() {
        $requestUri = $this->server['REQUEST_URI'] ?? '';
        // remove too many leading slashes - can be caused by reverse proxy configuration
        if (\strpos($requestUri, '/') === 0) {
            $requestUri = '/' . \ltrim($requestUri, '/');
Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 executeController has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function executeController($controller, $methodName) {
        $arguments = [];

        // valid types that will be casted
        $types = ['int', 'integer', 'bool', 'boolean', 'float'];
Severity: Minor
Found in lib/private/AppFramework/Http/Dispatcher.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