owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function processSimpleRoutes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function processSimpleRoutes($routes) {
        $simpleRoutes = isset($routes['routes']) ? $routes['routes'] : [];
        foreach ($simpleRoutes as $simpleRoute) {
            $name = $simpleRoute['name'];
            $postfix = '';
Severity: Minor
Found in lib/private/AppFramework/Routing/RouteConfig.php - About 55 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 getImagePath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getImagePath($app, $imageName) {
        $webRoot = $this->environmentHelper->getWebRoot();
        if ($app !== '') {
            $appWebPath = \OC_App::getAppWebPath($app);
        } else {
Severity: Minor
Found in lib/private/URLGenerator.php - About 55 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 reflect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function reflect($object, $method) {
        $reflection = new \ReflectionMethod($object, $method);
        $docs = $reflection->getDocComment();

        // extract everything prefixed by @ and first letter uppercase
Severity: Minor
Found in lib/private/AppFramework/Utility/ControllerMethodReflector.php - About 55 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 processOCS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function processOCS(array $routes) {
        $ocsRoutes = isset($routes['ocs']) ? $routes['ocs'] : [];
        foreach ($ocsRoutes as $ocsRoute) {
            $name = $ocsRoute['name'];
            $postFix = '';
Severity: Minor
Found in lib/private/AppFramework/Routing/RouteConfig.php - About 55 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 processResources has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function processResources($routes) {
        // declaration of all restful actions
        $actions = [
            ['name' => 'index', 'verb' => 'GET', 'on-collection' => true],
            ['name' => 'show', 'verb' => 'GET'],
Severity: Minor
Found in lib/private/AppFramework/Routing/RouteConfig.php - About 55 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 analyzePhpVersion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzePhpVersion(array $dependencies) {
        $missing = [];
        if (isset($dependencies['php']['@attributes']['min-version'])) {
            $minVersion = $dependencies['php']['@attributes']['min-version'];
            if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) {
Severity: Minor
Found in lib/private/App/DependencyAnalyzer.php - About 55 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 getUidAndFilename has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUidAndFilename($path) {
        list($storage, $internalPath) = $this->rootView->resolvePath($path);

        $absMountPoint = $this->rootView->getMountPoint($path);
        $parts = \explode('/', $absMountPoint);
Severity: Minor
Found in lib/private/Encryption/Util.php - About 55 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 streamCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function streamCopy($source, $target) {
        if (!$source or !$target) {
            return [0, false];
        }
        $bufSize = 8192;
Severity: Minor
Found in lib/private/legacy/helper.php - About 55 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 isAppCompatible has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isAppCompatible($ocVersion, $appInfo) {
        $requireMin = '';
        $requireMax = '';
        if (isset($appInfo['dependencies']['owncloud']['@attributes']['min-version'])) {
            $requireMin = $appInfo['dependencies']['owncloud']['@attributes']['min-version'];
Severity: Minor
Found in lib/private/legacy/app.php - About 55 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 centerCrop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function centerCrop($size = 0) {
        if (!$this->valid()) {
            $this->logger->error('OC_Image->centerCrop, No image loaded', ['app' => 'core']);
            return false;
        }
Severity: Minor
Found in lib/private/legacy/image.php - About 55 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 updateApp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function updateApp($appId) {
        \OC::$server->getAppManager()->clearAppsCache();
        $appPath = self::getAppPath($appId);
        if ($appPath === false) {
            return false;
Severity: Minor
Found in lib/private/legacy/app.php - About 55 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 setStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setStatus($status) {
        $protocol = \OC::$server->getRequest()->getHttpProtocol();
        switch ($status) {
            case self::STATUS_NOT_MODIFIED:
                $status = $status . ' Not Modified';
Severity: Minor
Found in lib/private/legacy/response.php - About 55 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 setCorsHeaders has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setCorsHeaders($userId, $domain, \OCP\IConfig $config = null, array $headers = []) {
        if ($config === null) {
            $config = \OC::$server->getConfig();
        }
        // first check if any of the global CORS domains matches
Severity: Minor
Found in lib/private/legacy/response.php - About 55 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 set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function set($data) {
        if ($data instanceof IImage) {
            $img = $data;
            $data = $img->data();
        } else {
Severity: Minor
Found in lib/private/Avatar.php - About 55 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 getSystemInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSystemInfo($allowAllDatabases = false) {
        $databases = $this->getSupportedDatabases($allowAllDatabases);

        $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data');

Severity: Minor
Found in lib/private/Setup.php - About 55 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 formatDateSpan has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null) {
        $l = $this->getLocale($l);
        $timestamp = $this->getDateTime($timestamp);
        $timestamp->setTime(0, 0, 0);
        if ($baseTimestamp === null) {
Severity: Minor
Found in lib/private/DateTimeFormatter.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(
        $appName,
        IDBConnection $connection,
        IOutput $output = null,
        AppLocator $appLocator = null,
Severity: Minor
Found in lib/private/DB/MigrationService.php - About 55 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 loginInOwnCloud has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function loginInOwnCloud($loginType, $user, $password, $options = []) {
        $login = $user->getUID();

        // check the login policies first. It will throw a LoginException if needed
        // The LoginPolicyManager can't be injected due to cyclic dependency
Severity: Minor
Found in lib/private/User/Session.php - About 55 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 clearRememberMeTokensForLoggedInUser has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function clearRememberMeTokensForLoggedInUser($targetToken) {
        $user = $this->getUser();
        $uid = $user->getUID();
        if ($targetToken !== null) {
            $hashedToken = \hash('snefru', $targetToken);
Severity: Minor
Found in lib/private/User/Session.php - About 55 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 getFileSizeViaCurl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFileSizeViaCurl($fileName) {
        if (\OC::$server->getIniWrapper()->getString('open_basedir') === '') {
            $pathParts = \explode('/', $fileName);
            $encodedPathParts = \array_map('rawurlencode', $pathParts);
            $encodedFileName = \implode('/', $encodedPathParts);
Severity: Minor
Found in lib/private/LargeFileHelper.php - About 55 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