MantisBT - Doomseeker
View Issue Details
0003818Doomseeker[All Projects] Cleanuppublic2020-06-07 07:182020-06-07 21:04
WubTheCaptain 
 
nonetrivialrandom
confirmedopen 
1.3.1 
 
0003818: Boolean expressions involving boolean constants (instead of expressing the boolean expression directly)
Elementary and pedantic about code style.
if (b == true) becomes if (b), and so on. This has been quite well followed, with only a few exceptions.

I will also agree something like bool ZandronumVersion::operator> (const ZandronumVersion &other) const is better written the way it is.
These are difficult to find with a text search and due to rarity, so I'll just point out one.
src/core/tests/testdatapaths.cpp:       } while (bEntryDoesExist == true);

Fortunately (or unfortunately), that's also part of the code that has rotten un(der)utilized.
Maybe this:
Quote from src/core/fileutils.cpp
bool FileUtils::containsPath(const QStringList &candidates, const QString &path)
{
        for (const QString &candidate : candidates)
        {
                if (QFileInfo(candidate) == QFileInfo(path))
                        return true;
        }
        return false;
}

Few more that I could find with grep -B 2 -A 2 -r 'return false' src/ | less.
'https://clang.llvm.org/extra/clang-tidy/checks/readability-simplify-boolean-expr.html [^]'
No tags attached.
Issue History
2020-06-07 07:18WubTheCaptainNew Issue
2020-06-07 07:19WubTheCaptainSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13136#r13136
2020-06-07 21:04Pol MNote Added: 0021392
2020-06-07 21:04Pol MStatusnew => confirmed

Notes
(0021392)
Pol M   
2020-06-07 21:04   
Yep. The src/core/fileutils.cpp example could use the <algorithm> std::find/std::find_if (as suggested by Qt himself as qFind seems deprecated)'https://doc.qt.io/qt-5/qtalgorithms.html#qt-and-the-stl-algorithms [^]'