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

Enable clazy connect-3arg-lambda

parent 91bce4a0
...@@ -48,7 +48,7 @@ build_clazy_clang_tidy: ...@@ -48,7 +48,7 @@ build_clazy_clang_tidy:
script: 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 - 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_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot" ninja - CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot,connect-3arg-lambda" ninja
# Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later # 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 - 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: '*'}\"" - "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: '*'}\""
...@@ -56,7 +56,7 @@ void FormatTest::initTestCase() ...@@ -56,7 +56,7 @@ void FormatTest::initTestCase()
const QMimeType mime = db.mimeTypeForFile( testFile ); const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument( testFile, QUrl(), mime), Okular::Document::OpenSuccess ); QCOMPARE( m_document->openDocument( testFile, QUrl(), mime), Okular::Document::OpenSuccess );
connect( m_document, &Okular::Document::refreshFormWidget, [=]( Okular::FormField * form ) connect( m_document, &Okular::Document::refreshFormWidget, this, [this]( Okular::FormField * form )
{ {
Okular::FormFieldText *fft = reinterpret_cast< Okular::FormFieldText * >( form ); Okular::FormFieldText *fft = reinterpret_cast< Okular::FormFieldText * >( form );
if( fft ) if( fft )
......
...@@ -515,7 +515,7 @@ void PartTest::testRClickWhileLinkTextIsSelected() ...@@ -515,7 +515,7 @@ void PartTest::testRClickWhileLinkTextIsSelected()
// the menu disappear // the menu disappear
PageView *view = part.m_pageView; PageView *view = part.m_pageView;
bool menuClosed = false; bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() { QTimer::singleShot(2000, view, [view, &menuClosed]() {
// check if popup menu is active and visible // check if popup menu is active and visible
QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu"))); QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu")));
QVERIFY(menu); QVERIFY(menu);
...@@ -584,7 +584,7 @@ void PartTest::testRClickOverLinkWhileLinkTextIsSelected() ...@@ -584,7 +584,7 @@ void PartTest::testRClickOverLinkWhileLinkTextIsSelected()
// the menu disappear // the menu disappear
PageView *view = part.m_pageView; PageView *view = part.m_pageView;
bool menuClosed = false; bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() { QTimer::singleShot(2000, view, [view, &menuClosed]() {
// check if popup menu is active and visible // check if popup menu is active and visible
QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu"))); QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu")));
QVERIFY(menu); QVERIFY(menu);
...@@ -641,7 +641,7 @@ void PartTest::testRClickOnSelectionModeShoulShowFollowTheLinkMenu() ...@@ -641,7 +641,7 @@ void PartTest::testRClickOnSelectionModeShoulShowFollowTheLinkMenu()
// the menu disappear // the menu disappear
PageView *view = part.m_pageView; PageView *view = part.m_pageView;
bool menuClosed = false; bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() { QTimer::singleShot(2000, view, [view, &menuClosed]() {
// check if popup menu is active and visible // check if popup menu is active and visible
QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu"))); QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu")));
QVERIFY(menu); QVERIFY(menu);
...@@ -745,7 +745,7 @@ void PartTest::testeRectSelectionStartingOnLinks() ...@@ -745,7 +745,7 @@ void PartTest::testeRectSelectionStartingOnLinks()
// the menu disappear // the menu disappear
PageView *view = part.m_pageView; PageView *view = part.m_pageView;
bool menuClosed = false; bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() { QTimer::singleShot(2000, view, [view, &menuClosed]() {
QApplication::clipboard()->clear(); QApplication::clipboard()->clear();
// check if popup menu is active and visible // check if popup menu is active and visible
......
...@@ -4599,7 +4599,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo ...@@ -4599,7 +4599,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo
{ {
QAction * actCopyLinkLocation = menu->addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Link Address" ) ); QAction * actCopyLinkLocation = menu->addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Link Address" ) );
actCopyLinkLocation->setObjectName(QStringLiteral("CopyLinkLocationAction")); actCopyLinkLocation->setObjectName(QStringLiteral("CopyLinkLocationAction"));
connect( actCopyLinkLocation, &QAction::triggered, [ link ]() { connect( actCopyLinkLocation, &QAction::triggered, menu, [ link ]() {
const Okular::BrowseAction * browseLink = static_cast< const Okular::BrowseAction * >( link ); const Okular::BrowseAction * browseLink = static_cast< const Okular::BrowseAction * >( link );
QClipboard *cb = QApplication::clipboard(); QClipboard *cb = QApplication::clipboard();
cb->setText( browseLink->url().toDisplayString(), QClipboard::Clipboard ); cb->setText( browseLink->url().toDisplayString(), QClipboard::Clipboard );
...@@ -4608,7 +4608,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo ...@@ -4608,7 +4608,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo
} ); } );
} }
connect( processLink, &QAction::triggered, [this, link]() { connect( processLink, &QAction::triggered, this, [this, link]() {
d->document->processAction( link ); d->document->processAction( link );
}); });
return menu; return menu;
...@@ -4621,7 +4621,7 @@ void PageView::addSearchWithinDocumentAction(QMenu *menu, const QString &searchT ...@@ -4621,7 +4621,7 @@ void PageView::addSearchWithinDocumentAction(QMenu *menu, const QString &searchT
const QString squeezedText = KStringHandler::rsqueeze( searchText, searchTextPreviewLength ); const QString squeezedText = KStringHandler::rsqueeze( searchText, searchTextPreviewLength );
QAction *action = new QAction(i18n("Search for '%1' in this document", squeezedText), menu); QAction *action = new QAction(i18n("Search for '%1' in this document", squeezedText), menu);
action->setIcon( QIcon::fromTheme( QStringLiteral("document-preview") ) ); action->setIcon( QIcon::fromTheme( QStringLiteral("document-preview") ) );
connect(action, &QAction::triggered, [this, searchText]{Q_EMIT triggerSearch(searchText);}); connect(action, &QAction::triggered, this, [this, searchText]{Q_EMIT triggerSearch(searchText);});
menu->addAction( action ); menu->addAction( action );
} }
......
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