Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/filesystembase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
QFile file(filename);
QFile::Permissions permissions = file.permissions();

QFile::Permissions allWritePermissions = QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther | QFile::WriteOwner;

Check warning on line 141 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "allWritePermissions" of type "class QFlags<enum QFileDevice::Permission>" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLD&open=AZ-pgZ0niLnwHvvkJhLD&pullRequest=10470
static QFile::Permissions defaultWritePermissions = getDefaultWritePermissions();

permissions &= ~allWritePermissions;
Expand Down Expand Up @@ -481,7 +481,7 @@
// not valid. There needs to be one initialised here. Otherwise the incoming
// fileInfo is re-used.
if (fileInfo.filePath() != filename) {
QFileInfo myFI(filename);

Check warning on line 484 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "myFI" of type "class QFileInfo" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLE&open=AZ-pgZ0niLnwHvvkJhLE&pullRequest=10470
re = myFI.isFile();
}
return re;
Expand Down Expand Up @@ -515,7 +515,7 @@
// not valid. There needs to be one initialised here. Otherwise the incoming
// fileInfo is re-used.
if (fileInfo.filePath() != filename) {
QFileInfo myFI(filename);

Check warning on line 518 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "myFI" of type "class QFileInfo" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLF&open=AZ-pgZ0niLnwHvvkJhLF&pullRequest=10470
re = myFI.isWritable();
}
return re;
Expand Down Expand Up @@ -549,7 +549,7 @@
// not valid. There needs to be one initialised here. Otherwise the incoming
// fileInfo is re-used.
if (fileInfo.filePath() != filename) {
QFileInfo myFI(filename);

Check warning on line 552 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "myFI" of type "class QFileInfo" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLG&open=AZ-pgZ0niLnwHvvkJhLG&pullRequest=10470
re = myFI.isReadable();
}
return re;
Expand All @@ -567,7 +567,7 @@
// not valid. There needs to be one initialised here. Otherwise the incoming
// fileInfo is re-used.
if (fileInfo.filePath() != filename) {
QFileInfo myFI(filename);

Check warning on line 570 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "myFI" of type "class QFileInfo" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLH&open=AZ-pgZ0niLnwHvvkJhLH&pullRequest=10470
re = myFI.isSymLink();
}
return re;
Expand Down Expand Up @@ -605,7 +605,7 @@
setFileReadOnly(windowsSafeFileName, false);
#endif
const auto deletedFileInfo = QFileInfo{windowsSafeFileName};
if (!deletedFileInfo.exists()) {

Check warning on line 608 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the init-statement to declare "deletedFileInfo" inside the if statement.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLI&open=AZ-pgZ0niLnwHvvkJhLI&pullRequest=10470
qCWarning(lcFileSystem()) << windowsSafeFileName << "has been already deleted";
}

Expand Down Expand Up @@ -671,11 +671,11 @@
return true;
}

namespace {

/**
* This function creates a file handle with the desired LockMode
*/

Check warning on line 678 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Edit this comment to use the C++ format, i.e. "//".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLC&open=AZ-pgZ0niLnwHvvkJhLC&pullRequest=10470
#if defined Q_OS_WIN
Utility::Handle lockFile(const QString &fileName, FileSystem::LockMode mode)
{
Expand Down Expand Up @@ -723,7 +723,7 @@

}

Check warning on line 724 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this empty namespace.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLJ&open=AZ-pgZ0niLnwHvvkJhLJ&pullRequest=10470

bool FileSystem::isFileLocked(const QString &fileName, LockMode mode)

Check warning on line 726 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "mode" of type "enum OCC::FileSystem::LockMode" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLK&open=AZ-pgZ0niLnwHvvkJhLK&pullRequest=10470
{
#ifdef Q_OS_WIN
const auto handle = lockFile(fileName, mode);
Expand All @@ -732,12 +732,12 @@
if (error == ERROR_SHARING_VIOLATION || error == ERROR_LOCK_VIOLATION) {
return true;
} else if (error != ERROR_FILE_NOT_FOUND && error != ERROR_PATH_NOT_FOUND) {
qCWarning(lcFileSystem()) << Q_FUNC_INFO << Utility::formatWinError(error);
qCWarning(lcFileSystem()) << Q_FUNC_INFO << Utility::formatWinError(error) << fileName;
}
}
#else
Q_UNUSED(fileName);
Q_UNUSED(mode);

Check warning on line 740 in src/common/filesystembase.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Modify the macro definition so that it needs to be followed by a semicolon, or remove this empty statement.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ-pgZ0niLnwHvvkJhLL&open=AZ-pgZ0niLnwHvvkJhLL&pullRequest=10470
#endif
return false;
}
Expand Down
Loading