Web lists-archives.com

Re: Code in peace or How to lint a complete repository?




On 28.02.2018 22:41, Elvis Angelaccio wrote:
On mercoledì 28 febbraio 2018 10:57:30 CET, Michael Heidelbach wrote:
Hi!

Now that I saw https://phabricator.kde.org/D10905, I want to do something similar for baloo and baloo-widgets.

I'd really like to that once and for all. Because applying coding style on-the-fly obscures real changes introduced.

1. Would it be reasonable?
2. Who would be willing to review such a huge diff?
3. How to apply KDE coding style most effectively?
 (The astyle command given in Kdelibs Coding Style does not produce completely correct results:
    [this](const QUrl &url)  => [this](const QUrl & url)   instead of  [this](const QUrl& url)
    Also the operators-at-beginning-of-line rule is not respected )
4. What about arcanist: any ready-made .arclint available?

Cheers,

Michael

Hi Michael,
you may want to try uncrustify which is supposed to replace astyle: https://commits.kde.org/kde-dev-scripts/e93a28b3eb153695e8edb7ae259243b7b409a29d

(Someone should update the wiki :P)

Cheers,
Elvis


Thanks Elvis!

The results of  uncrustify-kf5 are not quite satisfactory. uncrustify-kf5.cfg needs some tweaks. Examples


This is wrong (and most easily fixed):

-    static DBState fromTransaction(Transaction* tr);
-    static bool debugCompare(const DBState& st1, const DBState& st2);
+    static DBState fromTransaction(Transaction *tr);
+    static bool debugCompare(const DBState &st1, const DBState &st2);

This may be right, but it looks weird to me:

-    QMap<QByteArray, QVector<PositionInfo>> positionDb;
+    QMap<QByteArray, QVector<PositionInfo> > positionDb;

-    QBENCHMARK { pc.decode(ba); }
+    QBENCHMARK { pc.decode(ba);
+    }

Close to unreadable:

-            if(sf.startsWith(QLatin1String("."))) {
-                if(!SetFileAttributesW(reinterpret_cast<const WCHAR*>((dir.path() + "/" + sf).utf16()), FILE_ATTRIBUTE_HIDDEN)) {
+            if (sf.startsWith(QLatin1String("."))) {
+                if (!SetFileAttributesW(reinterpret_cast<const WCHAR*>((dir.path() + "/"
+                                                                        + sf).utf16()),
+                                        FILE_ATTRIBUTE_HIDDEN)) {
                     qWarning("failed to set 'hidden' attribute!");
                 }
             }


Cheers,

Michael