owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function loadCategory has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    loadCategory: function(categoryId) {
        var self = this;
        if (OC.Settings.Apps.State.currentCategory === categoryId) {
            return;
        }
Severity: Major
Found in settings/js/admin-apps.js - About 2 hrs to fix

    Function loadPreview has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            loadPreview: function(path, mime, etag, $iconDiv, $container, isImage) {
                var maxImageWidth  = $container.parent().width() + 50;  // 50px for negative margins
                var maxImageHeight = maxImageWidth / (16/9);
                var smallPreviewSize = 75;
    
    
    Severity: Major
    Found in apps/files/js/mainfileinfodetailview.js - About 2 hrs to fix

      Method validate has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function validate(IStorageConfig $storage) {
              $mountPoint = $storage->getMountPoint();
              if ($mountPoint === '' || $mountPoint === '/') {
                  return new DataResponse(
                      [
      Severity: Major
      Found in apps/files_external/lib/Controller/StoragesController.php - About 2 hrs to fix

        Method writeBack has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function writeBack($tmpFile) {
                if (isset(self::$tempFiles[$tmpFile])) {
                    $path = self::$tempFiles[$tmpFile];
                    $parentFolder = $this->getDriveFile(\dirname($path));
                    if ($parentFolder) {
        Severity: Major
        Found in apps/files_external/lib/Lib/Storage/Google.php - About 2 hrs to fix

          Method fopen has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function fopen($path, $mode) {
                  $this->init();
                  $path = $this->cleanPath($path);
                  switch ($mode) {
                      case 'r':
          Severity: Major
          Found in lib/private/Files/Storage/DAV.php - About 2 hrs to fix

            Method createDBUser has 66 lines of code (exceeds 25 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: Major
            Found in lib/private/Setup/OCI.php - About 2 hrs to fix

              Method validateExpirationDate has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function validateExpirationDate(\OCP\Share\IShare $share, $skipPastDateValidation = false) {
                      $expirationDate = $share->getExpirationDate();
              
                      if ($expirationDate !== null) {
                          // Set the expiration date to just the date at "zero" time in the day
              Severity: Major
              Found in lib/private/Share20/Manager.php - About 2 hrs to fix

                Method loadCommands has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function loadCommands(InputInterface $input, OutputInterface $output) {
                        // $application is required to be defined in the register_command scripts
                        $application = $this->application;
                        $inputDefinition = $application->getDefinition();
                        $inputDefinition->addOption(
                Severity: Major
                Found in lib/private/Console/Application.php - About 2 hrs to fix

                  Function reloadCallback has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          reloadCallback: function(status, result) {
                              delete this._reloadCall;
                              this.hideMask();
                  
                              if (status === 401) {
                  Severity: Major
                  Found in apps/files/js/filelist.js - About 2 hrs to fix

                    File oc.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    OC.L10N.register(
                        "core",
                        {
                        "Please select a file." : "Seleccionatz un fichièr.",
                        "File is too big" : "Fichièr tròp voluminós",
                    Severity: Minor
                    Found in core/l10n/oc.js - About 2 hrs to fix

                      Method getSpecialParameterList has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getSpecialParameterList($app, $text) {
                              if ($app === self::FILES_SHARING_APP) {
                                  switch ($text) {
                                      case self::SUBJECT_REMOTE_SHARE_RECEIVED:
                                      case self::SUBJECT_REMOTE_SHARE_UNSHARED:
                      Severity: Major
                      Found in apps/files_sharing/lib/Activity.php - About 2 hrs to fix

                        Method execute has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function execute(InputInterface $input, OutputInterface $output): int {
                                $sourceUserObject = $this->userManager->get($input->getArgument('source-user'));
                                $destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));
                                if ($sourceUserObject === null) {
                                    $output->writeln("<error>Unknown source user $this->sourceUser</error>");
                        Severity: Major
                        Found in apps/files/lib/Command/TransferOwnership.php - About 2 hrs to fix

                          Method updateStorage has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function updateStorage(IStorageConfig $updatedStorage) {
                                  $id = $updatedStorage->getId();
                          
                                  $existingMount = $this->dbConfig->getMountById($id);
                          
                          
                          Severity: Major
                          Found in lib/private/Files/External/Service/StoragesService.php - About 2 hrs to fix

                            Method changeSchema has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function changeSchema(Schema $schema, array $options) {
                                    $prefix = $options['tablePrefix'];
                                    $table = $schema->createTable("{$prefix}persistent_locks");
                                    $table->addColumn('id', Type::BIGINT, [
                                        'autoincrement' => true,
                            Severity: Major
                            Found in core/Migrations/Version20180607072706.php - About 2 hrs to fix

                              Function listen has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  listen:function(type,callback){
                                      if(callback && callback.call){
                              
                                          if(type){
                                              if(this.useFallBack){
                              Severity: Minor
                              Found in core/js/eventsource.js - About 2 hrs 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 restore has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function restore($filename, $targetLocation = null) {
                                      $user = User::getUser();
                                      $view = new View('/' . $user);
                                      $nameOfFile = \basename($filename);
                                      $dirOfFile = \dirname($filename);
                              Severity: Minor
                              Found in apps/files_trashbin/lib/Trashbin.php - About 2 hrs 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 removeFromGroup has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function removeFromGroup($parameters) {
                                      // Check if user is logged in
                                      $loggedInUser = $this->userSession->getUser();
                                      if ($loggedInUser === null) {
                                          return new Result(null, API::RESPOND_UNAUTHORISED);
                              Severity: Minor
                              Found in apps/provisioning_api/lib/Users.php - About 2 hrs 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 store has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function store($filename) {
                                      if (\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
                                          // if the file gets streamed we need to remove the .part extension
                                          // to get the right target
                                          $ext = \pathinfo($filename, PATHINFO_EXTENSION);
                              Severity: Minor
                              Found in apps/files_versions/lib/Storage.php - About 2 hrs 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 search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function search($search, $limit = null, $offset = null, $scope = null, $alwaysReturnAllMatches = false) {
                                      $groups = [];
                                      if ($alwaysReturnAllMatches || $this->userSearch->isSearchable($search)) {
                                          foreach ($this->backends as $backend) {
                                              if (!$backend->isVisibleForScope($scope)) {
                              Severity: Minor
                              Found in lib/private/Group/Manager.php - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function __construct($params) {
                                      $this->statCache = new ArrayCache();
                                      $this->httpClientService = \OC::$server->getHTTPClientService();
                                      $this->webDavClientService = \OC::$server->getWebDavClientService();
                                      if (isset($params['host'], $params['user'], $params['password'])) {
                              Severity: Minor
                              Found in lib/private/Files/Storage/DAV.php - About 2 hrs 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