Commit dcf8f794 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable clazy isempty-vs-count and qhash-with-char-pointer-key

parent 46d1ba0e
......@@ -48,7 +48,7 @@ build_clazy_clang_tidy:
script:
- srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json
- CLAZY_IGNORE_DIRS="settings_core.[cpp|h]|settings.[cpp.h]|pdfsettings.h|gssettings.h" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-qstring-allocations" ninja
- CLAZY_IGNORE_DIRS="settings_core.[cpp|h]|settings.[cpp.h]|pdfsettings.h|gssettings.h" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-qstring-allocations,isempty-vs-count,qhash-with-char-pointer-key" ninja
# Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later
- sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h
- "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\""
......@@ -1193,7 +1193,7 @@ static WordsWithCharacters makeWordFromCharacters(const TextList &characters, in
while (!space)
{
if (textString.length())
if (!textString.isEmpty())
{
newString.append(textString);
......
......@@ -122,7 +122,7 @@ bool Index::makeIndex(const QList< QUrl >& docs, EBook *chmFile )
void Index::insertInDict( const QString &str, int docNum )
{
Entry *e = nullptr;
if ( dict.count() )
if ( !dict.isEmpty() )
e = dict[ str ];
if ( e )
......@@ -377,7 +377,7 @@ QList< QUrl > Index::query(const QStringList &terms, const QStringList &termSeq,
}
}
if ( !termList.count() )
if ( termList.isEmpty() )
return QList< QUrl >();
std::sort(termList.begin(), termList.end());
......@@ -482,10 +482,7 @@ bool Index::searchForPhrases( const QStringList &phrases, const QStringList &wor
}
}
if ( first_word_positions.count() )
return true;
return false;
return !first_word_positions.isEmpty();
}
......
......@@ -557,7 +557,7 @@ void Sidebar::setMainWidget( QWidget *widget )
if ( !d->splitterSizesSet )
{
QList<int> splitterSizes = Okular::Settings::splitterSizes();
if ( !splitterSizes.count() )
if ( splitterSizes.isEmpty() )
{
// the first time use 1/10 for the panel and 9/10 for the pageView
splitterSizes.push_back( 50 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment