owncloud/core

View on GitHub

Showing 4,482 of 4,482 total issues

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

    public function getL10nFilesForApp($app, $lang) {
        $languageFiles = [];

        $i18nDir = $this->findL10nDir($app);
        $transFile = \strip_tags($i18nDir) . \strip_tags($lang) . '.json';
Severity: Minor
Found in lib/private/L10N/Factory.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 setUserValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setUserValue($userId, $appName, $key, $value, $preCondition = null) {
        if (!\is_int($value) && !\is_float($value) && !\is_string($value)) {
            throw new \UnexpectedValueException('Only integers, floats and strings are allowed as value');
        }

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

    private function checkTokenCredentials(IToken $dbToken, $token) {
        // Check whether login credentials are still valid and the user was not disabled
        // This check is performed each 5 minutes per default
        // However, we try to read last_check_timeout from the appconfig table so the
        // administrator could change this 5 minutes timeout
Severity: Minor
Found in lib/private/User/Session.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute($jobList, ILogger $logger = null) {
        if ((\time() - $this->lastRun) > $this->interval) {
            if ($logger !== null) {
                $id = $this->getId();
                $class = \get_class($this);
Severity: Minor
Found in lib/private/BackgroundJob/TimedJob.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 findL10nDirInTheme has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findL10nDirInTheme(string $themeDir, $app): string {
        if ($app) {
            if (\in_array($app, ['core', 'lib', 'settings'])) {
                $p = $themeDir . '/' . $app . '/l10n/';
            } else {
Severity: Minor
Found in lib/private/L10N/Factory.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 getToken has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getToken(IRequest $request, &$token) {
        $authHeader = $request->getHeader('Authorization');
        if ($authHeader === null || \strpos($authHeader, 'token ') === false) {
            // No auth header, let's try session id
            try {
Severity: Minor
Found in lib/private/User/TokenAuthModule.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        if (!$input->getOption('accept-warning')) {
            $helper = new QuestionHelper();
            $q = <<<EOS
<question>This command is for maintenance and support purposes. 
Severity: Minor
Found in core/Command/Background/Queue/Execute.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        if ($input->getOption('on')) {
            $this->config->setSystemValue('singleuser', true);
            $output->writeln('Single user mode enabled');
        } elseif ($input->getOption('off')) {
Severity: Minor
Found in core/Command/Maintenance/SingleUser.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 buildReflection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildReflection($appName, $controllerName, $method) {
        foreach ($this->listControllerNames($appName, $controllerName) as $controllerName) {
            foreach ($this->listMethodNames($method) as $m) {
                try {
                    $reflection = new \ReflectionMethod($controllerName, $m);
Severity: Minor
Found in core/Command/Security/ListRoutes.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 convertDB has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {
        $this->config->setSystemValue('maintenance', true);
        try {
            $fromSchema = $fromDB->createSchema();
            // copy table rows
Severity: Minor
Found in core/Command/Db/ConvertType.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 getFileTypeIcons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFileTypeIcons($themeDirectory) {
        $fileTypeIcons = [];
        $fileTypeIconDirectory = $themeDirectory . '/core/img/filetypes';

        if (\is_dir($fileTypeIconDirectory)) {
Severity: Minor
Found in core/Command/Maintenance/Mimetype/UpdateJS.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 syncMultipleUsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function syncMultipleUsers(
        InputInterface $input,
        OutputInterface $output,
        SyncService $syncService,
        UserInterface $backend,
Severity: Minor
Found in core/Command/User/SyncBackend.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $output->writeln('<info>This feature is currently experimental.</info>');
        $this->targetType = $this->connectionFactory->normalizeType($input->getArgument('type'));
        $this->targetHostname = $input->getArgument('hostname');
        $this->targetPort = $input->getOption('port');
Severity: Minor
Found in core/Command/Db/ConvertType.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 prepareParentFolder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepareParentFolder($path) {
        $path = Filesystem::normalizePath($path);
        // If the file resides within a subdirectory, create it
        if ($this->rootView->file_exists($path) === false) {
            $sub_dirs = \explode('/', \ltrim($path, '/'));
Severity: Minor
Found in core/Command/Encryption/ChangeKeyStorageRoot.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $configNames = $input->getArgument('name');
        $configName = $configNames[0];
        $configValue = $this->castValue($input->getOption('value'), $input->getOption('type'));
        $updateOnly = $input->getOption('update-only');
Severity: Minor
Found in core/Command/Config/System/SetConfig.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $outputType = $input->getOption('output');
        if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
            $certificates = \array_map(function (ICertificate $certificate) {
                return [
Severity: Minor
Found in core/Command/Security/ListCertificates.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 getSystemConfigs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getSystemConfigs($noSensitiveValues) {
        $keys = $this->systemConfig->getKeys();

        $configs = [];
        foreach ($keys as $key) {
Severity: Minor
Found in core/Command/Config/ListConfigs.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        if ($input->getOption('on')) {
            $this->config->setSystemValue('maintenance', true);
            $output->writeln('Maintenance mode enabled');
            $output->writeln('Please also consider to stop the web server on all ownCloud instances');
Severity: Minor
Found in core/Command/Maintenance/Mode.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 checkPerson has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkPerson($login, $password) {
        if ($login && $password) {
            $user = $this->userManager->checkPassword($login, $password);
            if ($user !== false) {
                $xml = [];
Severity: Minor
Found in core/Controller/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 email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function email($user) {
        try {
            $userObject = $this->userManager->get($user);
            if ($userObject === null) {
                $users = $this->userManager->getByEmail($user);
Severity: Minor
Found in core/Controller/LostController.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