owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function removeUser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function removeUser($user) {
        $result = false;
        if ($this->emitter) {
            $this->emitter->emit('\OC\Group', 'preRemoveUser', [$this, $user]);
        }
Severity: Minor
Found in lib/private/Group/Group.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 checkRegexAgainstFolderOrFile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function checkRegexAgainstFolderOrFile($regexList, $path, $callerMessage = '') {
        foreach ($regexList as $item) {
            // check if the first and last character is a '/' and add one if not
            // terminate with i == case insensitive
            $newItem = $item;
Severity: Minor
Found in lib/private/Files/Filesystem.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 update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function update($id, array $data) {
        unset(self::$path_cache[(int)$id]);
        if (isset($data['path'])) {
            // normalize path
            $data['path'] = $this->normalize($data['path']);
Severity: Minor
Found in lib/private/Files/Cache/Cache.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 getAllLegacyThemes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function getAllLegacyThemes() {
        $serverRoot = $this->environmentHelper->getServerRoot();
        $themes = [];
        if (\is_dir($serverRoot . '/themes')) {
            if ($handle = \opendir($serverRoot . '/themes')) {
Severity: Minor
Found in lib/private/Theme/ThemeService.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 fixThisShare has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function fixThisShare($groupShares, $subShares) {
        if (empty($subShares)) {
            return false;
        }

Severity: Minor
Found in lib/private/Repair/RepairUnmergedShares.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 checkLicenseFor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkLicenseFor(string $appid, array $options = []): bool {
        $currentTime = $this->timeFactory->getTime();

        $gracePeriod = $this->config->getAppValue('core', 'grace_period', null);
        if ($gracePeriod === null) {
Severity: Minor
Found in lib/private/License/LicenseManager.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 getOrCreateEntry has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function getOrCreateEntry($storageId, $path, $reuseFileId = null) {
        if ($path === '.') {
            $path = '';
        }
        // find the correct parent
Severity: Minor
Found in lib/private/Repair/RepairMismatchFileCachePath.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 buildClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildClass(ReflectionClass $class) {
        $constructor = $class->getConstructor();
        if ($constructor === null) {
            return $class->newInstance();
        } else {
Severity: Minor
Found in lib/private/AppFramework/Utility/SimpleContainer.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 getRemoteAddress has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRemoteAddress() {
        $remoteAddress = $this->server['REMOTE_ADDR'] ?? '';
        $trustedProxies = $this->config->getSystemValue('trusted_proxies', []);

        if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies)) {
Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 getStorageInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getStorageInfo($path, $rootInfo = null) {
        // return storage info without adding mount points
        $includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false);

        if (!$rootInfo) {
Severity: Minor
Found in lib/private/legacy/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 getDiff has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
        // adjust varchar columns with a length higher then getVarcharMaxLength to clob
        foreach ($targetSchema->getTables() as $table) {
            foreach ($table->getColumns() as $column) {
                if ($column->getType() instanceof StringType) {
Severity: Minor
Found in lib/private/DB/Migrator.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 call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function call($parameters) {
        $request = \OC::$server->getRequest();
        $method = $request->getMethod();

        // Prepare the request variables
Severity: Minor
Found in lib/private/legacy/api.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 copyr has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function copyr($source, \OCP\Files\Folder $target) {
        $dir = @\opendir($source);
        if ($dir === false) {
            throw new NoReadAccessException('No read permission for folder ' . $source);
        }
Severity: Minor
Found in lib/private/legacy/util.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $configNames = $input->getArgument('name');
        $configName = \array_shift($configNames);
        $defaultValue = $input->getOption('default-value');

Severity: Minor
Found in core/Command/Config/System/GetConfig.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 writeArrayInOutputFormat has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = self::DEFAULT_OUTPUT_PREFIX, $showIntKeys = false) {
        switch ($input->getOption('output')) {
            case self::OUTPUT_FORMAT_JSON:
                $output->writeln(\json_encode($items));
                break;
Severity: Minor
Found in core/Command/Base.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        if (\OCP\Util::needUpgrade()) {
            $output->writeln('Update required, skipping cron');
            return 1;
        }
Severity: Minor
Found in core/Command/System/Cron.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

Method create has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create(IShare $share) {
        $shareWith = $share->getSharedWith();
        $itemSource = $share->getNodeId();
        $itemType = $share->getNodeType();
        $permissions = $share->getPermissions();
Severity: Major
Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 2 hrs to fix

    Method isForbiddenFileOrDir has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
            $blacklistArray = [];
            $pathParts = [];
    
            // force blacklist/exclude arraylist/arrayRegex for unit tests
    Severity: Major
    Found in lib/private/Files/Filesystem.php - About 2 hrs to fix

      Method handleChildrenMove has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function handleChildrenMove($sourceStorageId, $sourcePath, $targetStorageId, $targetPath) {
              $platformName = $this->connection->getDatabasePlatform()->getName();
              $versionString = $this->connection->getDatabaseVersionString();
              $versionArray = \explode('.', $versionString);
      
      
      Severity: Major
      Found in lib/private/Files/Cache/Cache.php - About 2 hrs to fix

        Method getIdsForTag has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getIdsForTag($tag) {
                $result = null;
                $tagId = false;
                if (\is_numeric($tag)) {
                    $tagId = $tag;
        Severity: Major
        Found in lib/private/Tags.php - About 2 hrs to fix
          Severity
          Category
          Status
          Source
          Language