From kde-core-devel Thu Oct 17 07:46:35 2013 From: "Martin Klapetek" Date: Thu, 17 Oct 2013 07:46:35 +0000 To: kde-core-devel Subject: Re: Review Request 113298: KDirWatch code style: cleanup whitespace. Message-Id: <20131017074635.29676.6912 () vidsolbach ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=138199602725767 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============3613224724481157242==" --===============3613224724481157242== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/113298/#review41860 ----------------------------------------------------------- There are couple issues still, I pointed only bunch of them as they repeat themselves, so you might want to keep an eye on those Also, kdelibs coding style - http://techbase.kde.org/Policies/Kdelibs_Coding_Style tier1/kcoreaddons/src/lib/io/kdirwatch.h As per the kdelibs coding style, there should be spaces around operators too, so eg. "notify = false" etc tier1/kcoreaddons/src/lib/io/kdirwatch.h The & sign should be aligned at the variable name, eg. "QString &path" (like you have below) tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Entry* e -> Entry *e tier1/kcoreaddons/src/lib/io/kdirwatch.cpp There should be no spaces before ";", eg. "...!= end; ++it" tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Indent on 4 spaces tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Operator spaces: if (res < 0) { tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Operator spaces as well tier1/kcoreaddons/src/lib/io/kdirwatch.cpp This should probably be on separate lines tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Same as the block above tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Entry *e tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Indent one level more (should be 8 spaces at this level)....actually this whole file seems to have wrong indentation, so maybe fix all of that? tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Pointer signs to the variable -> KDirWatch *instance etc tier1/kcoreaddons/src/lib/io/kdirwatch.cpp Should be at the "if" line, eg. "if () {" tier1/kcoreaddons/src/lib/io/kdirwatch_p.h Spaces inside -> "KDirWatch *, bool" - Martin Klapetek On Oct. 17, 2013, 3:51 a.m., Nicolás Alvarez wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://git.reviewboard.kde.org/r/113298/ > ----------------------------------------------------------- > > (Updated Oct. 17, 2013, 3:51 a.m.) > > > Review request for KDE Frameworks and kdelibs. > > > Repository: kdelibs > > > Description > ------- > > KDirWatch code style: cleanup whitespace. > > The KDirWatch code had *lots* of "( foo )" and inconsistent indentation and alignment, including a few tabs(!). This is a full cleanup of it. > > I appreciate any feedback; if I "fixed" something that didn't need fixing, or if you see more whitespace errors that I didn't fix, or if I should push this to master too, or if I should leave the damn thing alone and discard the review :) > > This file is also lacking braces for single-line conditionals and loops; I'll fix that in a separate commit for easier reviewing. It's also mixing 2-space and 4-space indentations, but changing everything to 4 spaces (as the kdelibs coding style says) seemed too intrusive. Perhaps I should change the few 4-space indentations into 2-space for consistency? > > > Diffs > ----- > > tier1/kcoreaddons/src/lib/io/kdirwatch.h 7f6ca8ce83426c81a6336514c247aa9d115ec59e > tier1/kcoreaddons/src/lib/io/kdirwatch.cpp e4f45441d5ed68e3e34ae2bd68e16fd3dc46656a > tier1/kcoreaddons/src/lib/io/kdirwatch_p.h 442d6497b704c179adc13dbb25e450554d31554d > > Diff: http://git.reviewboard.kde.org/r/113298/diff/ > > > Testing > ------- > > Still compiles :) > > > Thanks, > > Nicolás Alvarez > > --===============3613224724481157242== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit
This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/113298/

There are couple issues still, I pointed only bunch of them as they repeat themselves, so you might want to keep an eye on those

Also, kdelibs coding style - http://techbase.kde.org/Policies/Kdelibs_Coding_Style

tier1/kcoreaddons/src/lib/io/kdirwatch.h (Diff revision 1)
class KCOREADDONS_EXPORT KDirWatch : public QObject
192
   void startScan( bool notify=false, bool skippedToo=false );
192
   void startScan(bool notify=false, bool skippedToo=false);
As per the kdelibs coding style, there should be spaces around operators too, so eg. "notify = false" etc

tier1/kcoreaddons/src/lib/io/kdirwatch.h (Diff revision 1)
class KCOREADDONS_EXPORT KDirWatch : public QObject
213
   bool contains( const QString& path ) const;
213
   bool contains(const QString& path) const;
The & sign should be aligned at the variable name, eg. "QString &path" (like you have below)

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
KDirWatchPrivate::~KDirWatchPrivate()
339
        Entry* e = &( *it );
339
        Entry* e = &(*it);
Entry* e -> Entry *e

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
void KDirWatchPrivate::Entry::addClient(KDirWatch* instance,
515
  for ( ; it != end ; ++it ) {
515
  for ( ; it != end ; ++it) {
There should be no spaces before ";", eg. "...!= end; ++it"

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
KDirWatchPrivate::Entry* KDirWatchPrivate::entry(const QString& _path)
614
    path.truncate( path.length() - 1 );
614
    path.truncate(path.length() - 1);
Indent on 4 spaces

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useFAM(Entry* e)
658
      if (res<0) {
658
      if (res<0) {
Operator spaces:

if (res < 0) {

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useFAM(Entry* e)
660
	use_fam=false;
660
        use_fam=false;
Operator spaces as well

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useFAM(Entry* e)
661
        delete sn; sn = 0;
661
        delete sn; sn = 0;
This should probably be on separate lines

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useFAM(Entry* e)
676
      if (res<0) {
676
      if (res<0) {
677
	e->m_mode = UnknownMode;
677
        e->m_mode = UnknownMode;
678
	use_fam=false;
678
        use_fam=false;
679
        delete sn; sn = 0;
679
        delete sn; sn = 0;
Same as the block above

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useFAM(Entry* e)
698
bool KDirWatchPrivate::useINotify( Entry* e )
698
bool KDirWatchPrivate::useINotify(Entry* e)
Entry *e

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useFAM(Entry* e)
720
    if (s_verboseDebug) {
720
    if (s_verboseDebug) {
Indent one level more (should be 8 spaces at this level)....actually this whole file seems to have wrong indentation, so maybe fix all of that?

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useQFSWatch(Entry* e)
781
void KDirWatchPrivate::addEntry(KDirWatch* instance, const QString& _path,
781
void KDirWatchPrivate::addEntry(KDirWatch* instance, const QString& _path,
782
                Entry* sub_entry, bool isDir, KDirWatch::WatchModes watchModes)
782
                Entry* sub_entry, bool isDir, KDirWatch::WatchModes watchModes)
Pointer signs to the variable -> KDirWatch *instance etc

tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (Diff revision 1)
bool KDirWatchPrivate::useQFSWatch(Entry* e)
798
  {
798
  {
Should be at the "if" line, eg. "if () {"

tier1/kcoreaddons/src/lib/io/kdirwatch_p.h (Diff revision 1)
public:
183
  void resetList (KDirWatch*,bool);
183
  void resetList(KDirWatch*,bool);
Spaces inside -> "KDirWatch *, bool"

- Martin Klapetek


On October 17th, 2013, 3:51 a.m. UTC, Nicolás Alvarez wrote:

Review request for KDE Frameworks and kdelibs.
By Nicolás Alvarez.

Updated Oct. 17, 2013, 3:51 a.m.

Repository: kdelibs

Description

KDirWatch code style: cleanup whitespace.

The KDirWatch code had *lots* of "( foo )" and inconsistent indentation and alignment, including a few tabs(!). This is a full cleanup of it.

I appreciate any feedback; if I "fixed" something that didn't need fixing, or if you see more whitespace errors that I didn't fix, or if I should push this to master too, or if I should leave the damn thing alone and discard the review :)

This file is also lacking braces for single-line conditionals and loops; I'll fix that in a separate commit for easier reviewing. It's also mixing 2-space and 4-space indentations, but changing everything to 4 spaces (as the kdelibs coding style says) seemed too intrusive. Perhaps I should change the few 4-space indentations into 2-space for consistency?

Testing

Still compiles :)

Diffs

  • tier1/kcoreaddons/src/lib/io/kdirwatch.h (7f6ca8ce83426c81a6336514c247aa9d115ec59e)
  • tier1/kcoreaddons/src/lib/io/kdirwatch.cpp (e4f45441d5ed68e3e34ae2bd68e16fd3dc46656a)
  • tier1/kcoreaddons/src/lib/io/kdirwatch_p.h (442d6497b704c179adc13dbb25e450554d31554d)

View Diff

--===============3613224724481157242==--