diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 2ec8d7fa..e548b370 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -604,8 +604,7 @@ BrowserService::searchEntries(const QSharedPointer& db, const QString& // Search for additional URL's starting with KP2A_URL if (entry->attributes()->keys().contains(ADDITIONAL_URL)) { for (const auto& key : entry->attributes()->keys()) { - if (key.startsWith(ADDITIONAL_URL) - && handleURL(entry->attributes()->value(key), url, submitUrl)) { + if (key.startsWith(ADDITIONAL_URL) && handleURL(entry->attributes()->value(key), url, submitUrl)) { entries.append(entry); continue; } @@ -1032,7 +1031,8 @@ bool BrowserService::handleURL(const QString& entryUrl, const QString& url, cons } // Match scheme - if (browserSettings()->matchUrlScheme() && !entryQUrl.scheme().isEmpty() && entryQUrl.scheme().compare(siteQUrl.scheme()) != 0) { + if (browserSettings()->matchUrlScheme() && !entryQUrl.scheme().isEmpty() + && entryQUrl.scheme().compare(siteQUrl.scheme()) != 0) { return false; } diff --git a/src/cli/Analyze.cpp b/src/cli/Analyze.cpp index 7fc00c8e..6095e988 100644 --- a/src/cli/Analyze.cpp +++ b/src/cli/Analyze.cpp @@ -55,8 +55,7 @@ int Analyze::executeWithDatabase(QSharedPointer database, QSharedPoint return EXIT_FAILURE; } - outputTextStream << QObject::tr("Evaluating database entries against HIBP file, this will take a while...") - << endl; + outputTextStream << QObject::tr("Evaluating database entries against HIBP file, this will take a while...") << endl; QList> findings; QString error; diff --git a/src/core/Database.h b/src/core/Database.h index 9c992994..d5f2092b 100644 --- a/src/core/Database.h +++ b/src/core/Database.h @@ -29,8 +29,8 @@ #include "crypto/kdf/AesKdf.h" #include "crypto/kdf/Kdf.h" #include "format/KeePass2.h" -#include "keys/PasswordKey.h" #include "keys/CompositeKey.h" +#include "keys/PasswordKey.h" class Entry; enum class EntryReferenceType; diff --git a/src/fdosecrets/objects/Collection.h b/src/fdosecrets/objects/Collection.h index 90286016..06d45a50 100644 --- a/src/fdosecrets/objects/Collection.h +++ b/src/fdosecrets/objects/Collection.h @@ -74,7 +74,8 @@ namespace FdoSecrets public: DBusReturn setProperties(const QVariantMap& properties); - bool isValid() const { + bool isValid() const + { return backend(); } diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 7190fb38..c610a773 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -375,9 +375,11 @@ void DatabaseOpenWidget::browseKeyFile() QString filename = fileDialog()->getOpenFileName(this, tr("Select key file"), QString(), filters); if (QFileInfo(filename).canonicalFilePath() == QFileInfo(m_filename).canonicalFilePath()) { - MessageBox::warning(this, tr("Cannot use database file as key file"), - tr("You cannot use your database file as a key file.\nIf you do not have a key file, please leave the field empty."), - MessageBox::Button::Ok); + MessageBox::warning(this, + tr("Cannot use database file as key file"), + tr("You cannot use your database file as a key file.\nIf you do not have a key file, " + "please leave the field empty."), + MessageBox::Button::Ok); filename = ""; } diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 9cbfa8fd..c8072641 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -166,7 +166,8 @@ void DatabaseTabWidget::addDatabaseTab(const QString& filePath, for (int i = 0, c = count(); i < c; ++i) { auto* dbWidget = databaseWidgetFromIndex(i); Q_ASSERT(dbWidget); - if (dbWidget && dbWidget->database()->canonicalFilePath().compare(canonicalFilePath, FILE_CASE_SENSITIVE) == 0) { + if (dbWidget + && dbWidget->database()->canonicalFilePath().compare(canonicalFilePath, FILE_CASE_SENSITIVE) == 0) { dbWidget->performUnlockDatabase(password, keyfile); if (!inBackground) { // switch to existing tab if file is already open diff --git a/src/gui/dbsettings/DatabaseSettingsWidget.cpp b/src/gui/dbsettings/DatabaseSettingsWidget.cpp index 224c4e56..c7f7f400 100644 --- a/src/gui/dbsettings/DatabaseSettingsWidget.cpp +++ b/src/gui/dbsettings/DatabaseSettingsWidget.cpp @@ -48,4 +48,3 @@ const QSharedPointer DatabaseSettingsWidget::getDatabase() const { return m_db; } - diff --git a/src/gui/masterkey/KeyFileEditWidget.h b/src/gui/masterkey/KeyFileEditWidget.h index 7d5868e8..dd414e13 100644 --- a/src/gui/masterkey/KeyFileEditWidget.h +++ b/src/gui/masterkey/KeyFileEditWidget.h @@ -32,7 +32,6 @@ class KeyFileEditWidget : public KeyComponentWidget { Q_OBJECT - public: explicit KeyFileEditWidget(DatabaseSettingsWidget* parent); Q_DISABLE_COPY(KeyFileEditWidget); diff --git a/tests/TestBrowser.cpp b/tests/TestBrowser.cpp index 039d0b15..938a7e4e 100644 --- a/tests/TestBrowser.cpp +++ b/tests/TestBrowser.cpp @@ -179,23 +179,22 @@ void TestBrowser::testSearchEntries() auto db = QSharedPointer::create(); auto* root = db->rootGroup(); - QStringList urls = { - "https://github.com/login_page", - "https://github.com/login", - "https://github.com/", - "github.com/login", - "http://github.com", - "http://github.com/login", - "github.com", - "github.com/login", - "https://github", // Invalid URL - "github.com" - }; + QStringList urls = {"https://github.com/login_page", + "https://github.com/login", + "https://github.com/", + "github.com/login", + "http://github.com", + "http://github.com/login", + "github.com", + "github.com/login", + "https://github", // Invalid URL + "github.com"}; createEntries(urls, root); browserSettings()->setMatchUrlScheme(false); - auto result = m_browserService->searchEntries(db, "https://github.com", "https://github.com/session"); // db, url, submitUrl + auto result = + m_browserService->searchEntries(db, "https://github.com", "https://github.com/session"); // db, url, submitUrl QCOMPARE(result.length(), 9); QCOMPARE(result[0]->url(), QString("https://github.com/login_page")); @@ -220,10 +219,7 @@ void TestBrowser::testSearchEntriesWithPort() auto db = QSharedPointer::create(); auto* root = db->rootGroup(); - QStringList urls = { - "http://127.0.0.1:443", - "http://127.0.0.1:80" - }; + QStringList urls = {"http://127.0.0.1:443", "http://127.0.0.1:80"}; createEntries(urls, root); @@ -237,11 +233,7 @@ void TestBrowser::testSearchEntriesWithAdditionalURLs() auto db = QSharedPointer::create(); auto* root = db->rootGroup(); - QStringList urls = { - "https://github.com/", - "https://www.example.com", - "http://domain.com" - }; + QStringList urls = {"https://github.com/", "https://www.example.com", "http://domain.com"}; auto entries = createEntries(urls, root); @@ -274,7 +266,7 @@ void TestBrowser::testInvalidEntries() "github.com/{}<>", "http:/example.com", }; - + createEntries(urls, root); browserSettings()->setMatchUrlScheme(true); @@ -348,17 +340,17 @@ void TestBrowser::testSubdomainsAndPaths() QCOMPARE(result[1]->url(), QString("https://accounts.example.com/path")); QCOMPARE(result[2]->url(), QString("https://example.com/")); // Accepts any subdomain - result = m_browserService->searchEntries(db, "https://another.accounts.example.com", "https://another.accounts.example.com"); + result = m_browserService->searchEntries( + db, "https://another.accounts.example.com", "https://another.accounts.example.com"); QCOMPARE(result.length(), 4); - QCOMPARE(result[0]->url(), QString("https://accounts.example.com")); // Accepts any subdomain under accounts.example.com + QCOMPARE(result[0]->url(), + QString("https://accounts.example.com")); // Accepts any subdomain under accounts.example.com QCOMPARE(result[1]->url(), QString("https://accounts.example.com/path")); QCOMPARE(result[2]->url(), QString("https://another.accounts.example.com/")); QCOMPARE(result[3]->url(), QString("https://example.com/")); // Accepts one or more subdomains // Test local files. It should be a direct match. - QStringList localFiles = { - "file:///Users/testUser/tests/test.html" - }; + QStringList localFiles = {"file:///Users/testUser/tests/test.html"}; createEntries(localFiles, root); @@ -372,18 +364,16 @@ void TestBrowser::testSortEntries() auto db = QSharedPointer::create(); auto* root = db->rootGroup(); - QStringList urls = { - "https://github.com/login_page", - "https://github.com/login", - "https://github.com/", - "github.com/login", - "http://github.com", - "http://github.com/login", - "github.com", - "github.com/login", - "https://github", // Invalid URL - "github.com" - }; + QStringList urls = {"https://github.com/login_page", + "https://github.com/login", + "https://github.com/", + "github.com/login", + "http://github.com", + "http://github.com/login", + "github.com", + "github.com/login", + "https://github", // Invalid URL + "github.com"}; auto entries = createEntries(urls, root); @@ -399,7 +389,6 @@ void TestBrowser::testSortEntries() QCOMPARE(result[2]->url(), QString("https://github.com/login")); QCOMPARE(result[3]->username(), QString("User 3")); QCOMPARE(result[3]->url(), QString("github.com/login")); - } void TestBrowser::testGetDatabaseGroups() diff --git a/tests/TestCli.cpp b/tests/TestCli.cpp index 8a9ab50c..9a2756ea 100644 --- a/tests/TestCli.cpp +++ b/tests/TestCli.cpp @@ -23,13 +23,13 @@ #include "core/Global.h" #include "core/Tools.h" #include "crypto/Crypto.h" -#include "keys/drivers/YubiKey.h" #include "format/Kdbx3Reader.h" #include "format/Kdbx3Writer.h" #include "format/Kdbx4Reader.h" #include "format/Kdbx4Writer.h" #include "format/KdbxXmlReader.h" #include "format/KeePass2.h" +#include "keys/drivers/YubiKey.h" #include "cli/Add.h" #include "cli/AddGroup.h" diff --git a/tests/TestFdoSecrets.cpp b/tests/TestFdoSecrets.cpp index 6994f60a..30d8da5c 100644 --- a/tests/TestFdoSecrets.cpp +++ b/tests/TestFdoSecrets.cpp @@ -21,9 +21,9 @@ #include "core/EntrySearcher.h" #include "fdosecrets/GcryptMPI.h" -#include "fdosecrets/objects/SessionCipher.h" #include "fdosecrets/objects/Collection.h" #include "fdosecrets/objects/Item.h" +#include "fdosecrets/objects/SessionCipher.h" #include "crypto/Crypto.h" @@ -96,8 +96,8 @@ void TestFdoSecrets::testDhIetf1024Sha256Aes128CbcPkcs7() void TestFdoSecrets::testCrazyAttributeKey() { - using FdoSecrets::Item; using FdoSecrets::Collection; + using FdoSecrets::Item; const QScopedPointer root(new Group()); const QScopedPointer e1(new Entry()); diff --git a/tests/util/TemporaryFile.cpp b/tests/util/TemporaryFile.cpp index 19622fae..3b1e3a58 100644 --- a/tests/util/TemporaryFile.cpp +++ b/tests/util/TemporaryFile.cpp @@ -71,7 +71,7 @@ bool TemporaryFile::copyFromFile(const QString& otherFileName) } QByteArray data; - while(!(data = otherFile.read(1024)).isEmpty()) { + while (!(data = otherFile.read(1024)).isEmpty()) { write(data); }