owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public function afterController($controller, $methodName, Response $response) {
        // only react if its a CORS request and if the request sends origin and
        $userId = null;
        if ($this->session->getUser() !== null) {
            $userId = $this->session->getUser()->getUID();
Severity: Minor
Found in lib/private/AppFramework/Middleware/Security/CORSMiddleware.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 decryptAll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
        $this->input = $input;
        $this->output = $output;

        if ($user !== '' && $this->userManager->userExists($user) === false) {
Severity: Minor
Found in lib/private/Encryption/DecryptAll.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 installShippedApps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function installShippedApps($softErrors = false) {
        $errors = [];
        $appsToInstall = Installer::getShippedApps();

        foreach ($appsToInstall as $appToInstall) {
Severity: Minor
Found in lib/private/Installer.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 createConnectionParams has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function createConnectionParams() {
        $type = $this->config->getValue('dbtype', 'sqlite');

        $connectionParams = [
            'user' => $this->config->getValue('dbuser', ''),
Severity: Minor
Found in lib/private/DB/ConnectionFactory.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 logClientIn has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function logClientIn($user, $password, IRequest $request) {
        $isTokenPassword = $this->isTokenPassword($password);
        if ($user === null || \trim($user) === '') {
            throw new \InvalidArgumentException('$user cannot be empty');
        }
Severity: Minor
Found in lib/private/User/Session.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 listJobsIncludingInvalid has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function listJobsIncludingInvalid(
        \Closure $validJobCallback,
        \Closure $invalidJobCallback
    ): void {
        $query = $this->connection->getQueryBuilder();
Severity: Minor
Found in lib/private/BackgroundJob/JobList.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 searchPaged has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function searchPaged($query, array $inApps = [], $page = 1, $size = 30) {
        $this->initProviders();
        $results = [];
        foreach ($this->providers as $provider) {
            /** @var $provider Provider */
Severity: Minor
Found in lib/private/Search.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 findLanguage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function findLanguage($app = null) {
        if ($this->requestLanguage !== '' && $this->languageExists($app, $this->requestLanguage)) {
            return $this->requestLanguage;
        }

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

    public function load($class) {
        $pathsToRequire = null;
        if ($this->memoryCache) {
            $pathsToRequire = $this->memoryCache->get($class);
        }
Severity: Minor
Found in lib/private/Autoloader.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 get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function get($uid, $evenMissing = false) {
        // fix numeric uid that was cast by storing it in an array key
        if (\is_numeric($uid)) {
            $uid = (string)$uid;
        }
Severity: Minor
Found in lib/private/User/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 syncSingleUser has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

    protected function execute(InputInterface $input, OutputInterface $output): int {
        '@phan-var \OC\Files\MimetypeDetector $this->mimetypeDetector';
        $mappings = $this->mimetypeDetector->getAllMappings();

        $totalFilecacheUpdates = 0;
Severity: Minor
Found in core/Command/Maintenance/Mimetype/UpdateDB.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 handleRemovedUsers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleRemovedUsers(array $removedUsers, InputInterface $input, OutputInterface $output, $missingAccountsAction): void {
        if (empty($removedUsers)) {
            $output->writeln('No removed users have been detected.');
        } else {
            // define some actions to be used
Severity: Minor
Found in core/Command/User/SyncBackend.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 render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        render: function() {
            var parts = this._makeCrumbs(this.dir || '/');
            var $crumb;
            this.$el.empty();
            this.breadcrumbs = [];
Severity: Minor
Found in apps/files/js/breadcrumb.js - About 1 hr to fix

    Function setSort has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            setSort: function(sort, direction, update, persist) {
                var comparator = FileList.Comparators[sort] || FileList.Comparators.name;
                this._sort = sort;
                this._sortDirection = (direction === 'desc')?'desc':'asc';
                this._sortComparator = comparator;
    Severity: Minor
    Found in apps/files/js/filelist.js - About 1 hr to fix

      Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              render: function() {
                  if (this.model) {
                      var isFavorite = (this.model.get('tags') || []).indexOf(OC.TAG_FAVORITE) >= 0;
                      this.$el.html(this.template({
                          type: this.model.isImage()? 'image': '',
      Severity: Minor
      Found in apps/files/js/mainfileinfodetailview.js - About 1 hr to fix

        Function updateSelectionSummary has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                updateSelectionSummary: function() {
                    var summary = this._selectionSummary.summary;
                    var selection;
        
                    var showHidden = !!this._filesConfig.get('showhidden');
        Severity: Minor
        Found in apps/files/js/filelist.js - About 1 hr to fix

          Function _onProgress has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _onProgress: function (e, data) {
                      if (e.lengthComputable) {
                          var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
                              loaded;
                          if (data._time && data.progressInterval &&
          Severity: Minor
          Found in apps/files/js/jquery.fileupload.js - About 1 hr to fix

            Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    render: function() {
                        var baseTemplate = this._getTemplate('base', TEMPLATE_BASE);
            
                        this.$el.html(baseTemplate({
                            cid: this.cid,
            Severity: Minor
            Found in core/js/sharedialogview.js - About 1 hr to fix

              Function putFileContents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      putFileContents: function(path, body, options) {
                          if (!path) {
                              throw 'Missing argument "path"';
                          }
                          var self = this;
              Severity: Minor
              Found in core/js/files/client.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language