owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function opendir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function opendir($path) {
        try {
            $list = $this->getConnection()->nlist($this->absPath($path));
            if ($list === false) {
                return false;
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SFTP.php - About 25 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 isPublishedVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function isPublishedVersion($view, $path) {
        if (self::metaEnabled()) {
            $versionFileInfo = $view->getFileInfo($path);
            if ($versionFileInfo) {
                $versionMetadata = self::$metaData->getVersionMetadata($versionFileInfo);
Severity: Minor
Found in apps/files_versions/lib/Storage.php - About 25 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 analyse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function analyse(OutputInterface $output) {
        $view = new View();
        $output->writeln("Analysing files of $this->sourceUser ...");
        $progress = new ProgressBar($output);
        $progress->start();
Severity: Minor
Found in apps/files/lib/Command/TransferOwnership.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($params) {
        // Register sftp://
        Stream::register();

        $parsedHost =  $this->splitHost($params['host']);
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SFTP.php - About 25 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 mkdir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function mkdir($path) {
        if (!$this->is_dir($path)) {
            $parentFolder = $this->getDriveFile(\dirname($path));
            if ($parentFolder) {
                $folder = new DriveFile();
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.php - About 25 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 getConnection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getConnection() {
        if ($this->client !== null) {
            return $this->client;
        }

Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SFTP.php - About 25 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 postStore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function postStore(string $filename) {
        if (self::metaEnabled()) {
            // we don't support versioned directories
            if (Filesystem::is_dir($filename) || !Filesystem::file_exists($filename)) {
                return false;
Severity: Minor
Found in apps/files_versions/lib/Storage.php - About 25 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 pre_renameOrCopy_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function pre_renameOrCopy_hook($params) {
        if (\OCP\App::isEnabled('files_versions')) {
            // if we rename a movable mount point, then the versions don't have
            // to be renamed
            $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
Severity: Minor
Found in apps/files_versions/lib/Hooks.php - About 25 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 handleAuthHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function handleAuthHeaders() {
        //copy http auth headers for apache+php-fcgid work around
        if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
            $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
        }
Severity: Minor
Found in lib/kernel.php - About 25 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 loadSection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadSection($type, $sectionID) {
        // Load built in sections
        foreach ($this->getBuiltInSections($type) as $section) {
            if ($section->getID() === $sectionID) {
                return $section;
Severity: Minor
Found in lib/private/Settings/SettingsManager.php - About 25 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 buildOCSResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildOCSResponse($format, $data) {
        if ($data instanceof Result) {
            $headers = $data->getHeaders();
            $d = $data->getData();
            $data = $data->getMeta();
Severity: Minor
Found in lib/public/AppFramework/OCSController.php - About 25 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 loadAppClassPaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loadAppClassPaths() {
        foreach (OC_App::getEnabledApps() as $app) {
            $appPath = OC_App::getAppPath($app);
            if ($appPath === false) {
                continue;
Severity: Minor
Found in lib/kernel.php - About 25 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 checkInstalled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkInstalled() {
        if (\defined('OC_CONSOLE')) {
            return;
        }
        // Redirect to installer if not installed
Severity: Minor
Found in lib/kernel.php - About 25 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 touch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function touch($path, $mtime = null) {
        // sets the modification time of the file to the given value.
        // If mtime is nil the current time is set.
        // note that the access time of the file always changes to the current time.
        if ($this->file_exists($path) and !$this->isUpdatable($path)) {
Severity: Minor
Found in lib/private/Files/Storage/Local.php - About 25 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 startHashingContexts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function startHashingContexts($algos = null) {
        if ($algos === null) {
            foreach ($this->hashingContexts as $key => $value) {
                $this->hashingContexts[$key] = \hash_init($key);
            }
Severity: Minor
Found in lib/private/Files/Stream/Checksum.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete() {
        // Prevent users from deleting group admin
        if ($this->getGID() === 'admin') {
            return false;
        }
Severity: Minor
Found in lib/private/Group/Group.php - About 25 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 getStream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStream($path, $mode) {
        if (\strrpos($path, '.') !== false) {
            $ext = \substr($path, \strrpos($path, '.'));
        } else {
            $ext = '';
Severity: Minor
Found in lib/private/Archive/TAR.php - About 25 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 count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function count($search = '') {
        $users = false;
        foreach ($this->backends as $backend) {
            if ($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) {
                if ($users === false) {
Severity: Minor
Found in lib/private/Group/Group.php - About 25 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 shouldEmitHooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function shouldEmitHooks($path = '') {
        if ($path && Cache\Scanner::isPartialFile($path)) {
            return false;
        }
        if (!Filesystem::$loaded) {
Severity: Minor
Found in lib/private/Files/View.php - About 25 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 changeLock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function changeLock($path, $type, $lockMountPoint = false) {
        $path = Filesystem::normalizePath($path);
        $absolutePath = $this->getAbsolutePath($path);
        $absolutePath = Filesystem::normalizePath($absolutePath);
        if (!$this->shouldLockFile($absolutePath)) {
Severity: Minor
Found in lib/private/Files/View.php - About 25 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