Skip to content
Draft
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
1 change: 1 addition & 0 deletions src/libsync/networkjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
// End elements with DAV:
if (type == QXmlStreamReader::EndElement) {
if (reader.namespaceUri() == QLatin1String("DAV:")) {
if (reader.name() == QStringLiteral("response")) {

Check failure on line 277 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest more than 3 if|for|do|while|switch statements.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PQ&open=AZ4DRfdHYVavbbx2F6PQ&pullRequest=9988
if (currentHref.endsWith('/')) {
currentHref.chop(1);
}
Expand Down Expand Up @@ -311,7 +311,7 @@

/*********************************************************************************************/

LsColJob::LsColJob(AccountPtr account, const QString &path)

Check warning on line 314 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "account" of type "class QSharedPointer<class OCC::Account>" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PR&open=AZ4DRfdHYVavbbx2F6PR&pullRequest=9988
: AbstractNetworkJob(account, path)
{
}
Expand All @@ -332,7 +332,7 @@
return _properties;
}

QList<QByteArray> LsColJob::defaultProperties(FolderType isRootPath, AccountPtr account)

Check warning on line 335 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "isRootPath" of type "enum OCC::LsColJob::FolderType" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PS&open=AZ4DRfdHYVavbbx2F6PS&pullRequest=9988

Check warning on line 335 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "account" of type "class QSharedPointer<class OCC::Account>" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PT&open=AZ4DRfdHYVavbbx2F6PT&pullRequest=9988
{
auto props = QList<QByteArray>{};

Expand Down Expand Up @@ -376,10 +376,10 @@
return props;
}

void LsColJob::propertyMapToRemoteInfo(const QMap<QString, QString> &map, RemotePermissions::MountedPermissionAlgorithm algorithm, RemoteInfo &result)

Check warning on line 379 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "algorithm" of type "enum OCC::RemotePermissions::MountedPermissionAlgorithm" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6Pq&open=AZ4DRfdHYVavbbx2F6Pq&pullRequest=9988

Check failure on line 379 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 67 to the 25 allowed.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6Pp&open=AZ4DRfdHYVavbbx2F6Pp&pullRequest=9988
{
for (auto it = map.constBegin(); it != map.constEnd(); ++it) {
QString property = it.key();

Check warning on line 382 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "property" of type "class QString" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6Pr&open=AZ4DRfdHYVavbbx2F6Pr&pullRequest=9988
QString value = it.value();
if (property == "resourcetype"_L1) {
result.isDirectory = value.contains("collection"_L1);
Expand All @@ -394,7 +394,7 @@
} else if (property == "getcontentlength"_L1) {
// See #4573, sometimes negative size values are returned
bool ok = false;
qlonglong ll = value.toLongLong(&ok);

Check warning on line 397 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "ll" of type "long long" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6Ps&open=AZ4DRfdHYVavbbx2F6Ps&pullRequest=9988
if (ok && ll >= 0) {
result.size = ll;
} else {
Expand Down Expand Up @@ -491,7 +491,7 @@

void LsColJob::start()
{
QList<QByteArray> properties = _properties;

Check warning on line 494 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "properties" of type "class QList<class QByteArray>" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6Pt&open=AZ4DRfdHYVavbbx2F6Pt&pullRequest=9988

if (properties.isEmpty()) {
qCWarning(lcLsColJob) << "Propfind with no properties!";
Expand All @@ -499,7 +499,7 @@
QByteArray propStr;
for (const auto &prop : properties) {
if (prop.contains(':')) {
int colIdx = prop.lastIndexOf(":");

Check warning on line 502 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int'

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PN&open=AZ4DRfdHYVavbbx2F6PN&pullRequest=9988
auto ns = prop.left(colIdx);
if (ns == "http://owncloud.org/ns") {
propStr += " <oc:" + prop.mid(colIdx + 1) + " />\n";
Expand All @@ -512,6 +512,7 @@
}

QNetworkRequest req;
req.setDecompressedSafetyCheckThreshold(-1); // TODO: make use of Nextcloud 31+'s pagination feature and re-enable this

Check warning on line 515 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PM&open=AZ4DRfdHYVavbbx2F6PM&pullRequest=9988
req.setRawHeader("Depth", "1");
QByteArray xml("<?xml version=\"1.0\" ?>\n"
"<d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\">\n"
Expand Down Expand Up @@ -636,7 +637,7 @@
if (!config.sessionCipher().isNull()) {
account->_sessionCipher = config.sessionCipher();
}
if (config.sessionTicket().length() > 0) {

Check warning on line 640 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use "isEmpty()" to check whether the container is empty or not.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6Pu&open=AZ4DRfdHYVavbbx2F6Pu&pullRequest=9988
account->_sessionTicket = config.sessionTicket();
}
}
Expand Down Expand Up @@ -1021,7 +1022,7 @@
QByteArray keyName = it.key();
QByteArray keyNs;
if (keyName.contains(':')) {
int colIdx = keyName.lastIndexOf(":");

Check warning on line 1025 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int'

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PO&open=AZ4DRfdHYVavbbx2F6PO&pullRequest=9988
keyNs = keyName.left(colIdx);
keyName = keyName.mid(colIdx + 1);
}
Expand Down Expand Up @@ -1172,7 +1173,7 @@
: QObject(parent)
, _account(account)
{
useFlow2 = ConfigFile().forceLoginV2();

Check warning on line 1176 in src/libsync/networkjobs.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not assign data members in a constructor. Initialize member "useFlow2" in an initialization list.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ4DRfdHYVavbbx2F6PP&open=AZ4DRfdHYVavbbx2F6PP&pullRequest=9988
}

void DetermineAuthTypeJob::start()
Expand Down
Loading