owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function doFind has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function doFind($script) {
        $fullScript = $this->addExtension($script);
        $themeDirectory = $this->theme->getDirectory();
        $baseDirectory = $this->theme->getBaseDirectory();
        $webRoot = '';
Severity: Minor
Found in lib/private/Template/JSResourceLocator.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 rename has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function rename($path1, $path2) {
        $srcParent = \dirname($path1);
        $dstParent = \dirname($path2);

        if (!$this->isUpdatable($srcParent)) {
Severity: Minor
Found in lib/private/Files/Storage/Local.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 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function get($file) {
        if (\is_string($file) or $file == '') {
            // normalize file
            $file = $this->normalize($file);

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

    private function createDBUser($connection) {
        $name = $this->dbUser;
        $password = $this->dbPassword;
        $query = 'SELECT * FROM all_users WHERE USERNAME = :un';
        $stmt = \oci_parse($connection, $query);
Severity: Minor
Found in lib/private/Setup/OCI.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 groupCreateChecks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function groupCreateChecks(\OCP\Share\IShare $share) {
        // Verify group shares are allowed
        if (!$this->allowGroupSharing()) {
            throw new \Exception('Group sharing is not allowed');
        }
Severity: Minor
Found in lib/private/Share20/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 getMessageForLicense has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMessageForLicense(array $info, string $language = null): array {
        $l = $this->l10nFactory->get('core', $language);

        // check if present
        if ($info['licenseState'] === ILicenseManager::LICENSE_STATE_MISSING) {
Severity: Minor
Found in lib/private/License/MessageService.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 moveAvatars has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function moveAvatars(IOutput $out, IUser $user) {
        $userId = $user->getUID();

        try {
            \OC\Files\Filesystem::initMountPoints($userId);
Severity: Minor
Found in lib/private/Repair/MoveAvatarIntoSubFolder.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 getLicenseWithState has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function getLicenseWithState(string $appid) {
        // check if license is missing
        $licenseObj = $this->licenseFetcher->getOwncloudLicense();
        if ($licenseObj === null) {
            $licenseState = ILicenseManager::LICENSE_STATE_MISSING;
Severity: Minor
Found in lib/private/License/LicenseManager.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 rmdirr has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public static function rmdirr($dir, $deleteSelf = true) {
        if (\is_dir($dir)) {
            $files = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
                RecursiveIteratorIterator::CHILD_FIRST
Severity: Minor
Found in lib/private/legacy/helper.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 getSupportedDatabases has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSupportedDatabases($allowAllDatabases = false) {
        $availableDatabases = [
            'sqlite' =>  [
                'type' => 'class',
                'call' => 'SQLite3',
Severity: Minor
Found in lib/private/Setup.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 saveColumn has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private static function saveColumn($column, $xml) {
        $xml->addChild('name', $column->getName());
        switch ($column->getType()) {
            case 'SmallInt':
            case 'Integer':
Severity: Minor
Found in lib/private/DB/MDB2SchemaWriter.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 addExternalResource has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private static function addExternalResource($application, $prepend, $path, $type = "script") {
        if ($type === "style") {
            if (!\in_array($path, self::$styles)) {
                if ($prepend === true) {
                    \array_unshift(self::$styles, $path);
Severity: Minor
Found in lib/private/legacy/util.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 verifyAuthHeaders has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function verifyAuthHeaders($request) {
        $shallLogout = false;
        try {
            $lastUser = null;
            foreach ($this->getAuthModules(true) as $module) {
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 validateInput has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateInput(InputInterface $input, OutputInterface $output, $supportedDatabases) {
        $db = \strtolower($input->getOption('database'));

        if (!\in_array($db, $supportedDatabases)) {
            throw new InvalidArgumentException("Database <$db> is not supported.");
Severity: Minor
Found in core/Command/Maintenance/Install.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

Method __construct has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $appName,
        IRequest $request,
        IURLGenerator $urlGenerator,
        IUserManager $userManager,
        OC_Defaults $defaults,
Severity: Major
Found in core/Controller/LostController.php - About 1 hr to fix

    Function rebuildNavigation has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        rebuildNavigation: function() {
            $.getJSON(OC.filePath('settings', 'ajax', 'navigationdetect.php')).done(function(response){
                if(response.status === 'success'){
                    var idsToKeep = {};
                    var navEntries=response.nav_entries;
    Severity: Minor
    Found in settings/js/admin-apps.js - About 1 hr to fix

      Function _initFilterField has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  _initFilterField: function ($container) {
                      this.$filterField = $('<input type="hidden" name="tags"/>');
                      $container.append(this.$filterField);
                      this.$filterField.select2({
                          placeholder: t('systemtags', 'Select tags to filter by'),
      Severity: Minor
      Found in apps/systemtags/js/systemtagsfilelist.js - About 1 hr to fix

        Function getAuthUrl has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        OCA.External.Settings.OAuth2.getAuthUrl = function (backendUrl, data) {
            var $tr = data['tr'];
            var configured = $tr.find('[data-parameter="configured"]');
            var token = $tr.find('.configuration [data-parameter="token"]');
        
        
        Severity: Minor
        Found in apps/files_external/js/settings.js - About 1 hr to fix

          Function EventSource has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          OC.EventSource=function(src,data){
              var dataStr='';
              var name;
              var joinChar;
              this.typelessListeners=[];
          Severity: Minor
          Found in core/js/eventsource.js - About 1 hr to fix

            Function showNotification has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                showNotification: function() {
                    if (!this._template) {
                        this._template = Handlebars.compile(this.NOTIFICATION_TEMPLATE);
                    }
            
            
            Severity: Minor
            Found in core/js/license-trial-notification.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language