Commit 93540ac1 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable most of clazy level2

parent 968e9d60
Pipeline #15447 passed with stage
in 13 minutes and 17 seconds
......@@ -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_CHECKS="level0,level1,old-style-connect" ninja
- CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-copyable-polymorphic,no-qstring-allocations,no-missing-qobject-macro" 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: '*'}\""
......@@ -127,7 +127,7 @@ NormalizedRect::NormalizedRect( double l, double t, double r, double b )
// note: check for swapping coords?
: left( l ), top( t ), right( r ), bottom( b ) {}
NormalizedRect::NormalizedRect( const QRect & r, double xScale, double yScale )
NormalizedRect::NormalizedRect( const QRect & r, double xScale, double yScale ) // clazy:exclude=function-args-by-value TODO when BIC changes are allowed
: left( (double)r.left() / xScale ), top( (double)r.top() / yScale ),
right( (double)r.right() / xScale ), bottom( (double)r.bottom() / yScale ) {}
......
......@@ -185,7 +185,7 @@ QString DocumentPrivate::namePaperSize(double inchesWidth, double inchesHeight)
}
}
QString DocumentPrivate::localizedSize(const QSizeF &size) const
QString DocumentPrivate::localizedSize(const QSizeF size) const
{
double inchesWidth = 0, inchesHeight = 0;
switch (m_generator->pagesSizeMetric())
......
......@@ -136,7 +136,7 @@ class DocumentPrivate
bool updateMetadataXmlNameAndDocSize();
QString pagesSizeString() const;
QString namePaperSize(double inchesWidth, double inchesHeight) const;
QString localizedSize(const QSizeF &size) const;
QString localizedSize(const QSizeF size) const;
qulonglong calculateMemoryToFree();
void cleanupPixmapMemory();
void cleanupPixmapMemory( qulonglong memoryToFree );
......
......@@ -31,7 +31,7 @@
using namespace Okular;
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) TODO when BIC changes are allowed
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) clazy:exclude=function-args-by-ref TODO when BIC changes are allowed
QPrinter::Orientation documentOrientation, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, const QString &pageRange )
{
......@@ -39,7 +39,7 @@ int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(perf
pageSelectPolicy, pageRange, ScaleMode::FitToPrintArea );
}
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) TODO when BIC changes are allowed
int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(performance-unnecessary-value-param) clazy:exclude=function-args-by-ref TODO when BIC changes are allowed
QPrinter::Orientation documentOrientation,
FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy,
const QString &pageRange, ScaleMode scaleMode )
......@@ -49,7 +49,7 @@ int FilePrinter::printFile(QPrinter &printer, const QString file, // NOLINT(perf
documentOrientation, scaleMode );
}
int FilePrinter::doPrintFiles(QPrinter &printer, const QStringList fileList, FileDeletePolicy fileDeletePolicy, // NOLINT(performance-unnecessary-value-param) TODO when BIC changes are allowed
int FilePrinter::doPrintFiles(QPrinter &printer, const QStringList fileList, FileDeletePolicy fileDeletePolicy, // NOLINT(performance-unnecessary-value-param) clazy:exclude=function-args-by-ref TODO when BIC changes are allowed
PageSelectPolicy pageSelectPolicy, const QString &pageRange,
QPrinter::Orientation documentOrientation )
{
......
......@@ -518,7 +518,7 @@ void Generator::requestFontData(const Okular::FontInfo & /*font*/, QByteArray *
}
void Generator::setDPI(const QSizeF & dpi)
void Generator::setDPI(const QSizeF & dpi) // clazy:exclude=function-args-by-value TODO remove the & when we do a BIC change elsewhere
{
Q_D( Generator );
d->m_dpi = dpi;
......
......@@ -455,7 +455,7 @@ class OKULARCORE_EXPORT Generator : public QObject
*
* @since 0.19 (KDE 4.13)
*/
void setDPI(const QSizeF &dpi);
void setDPI(const QSizeF &dpi); // TODO remove the & when we do a BIC change elsewhere
/**
* Returns the 'layers model' object of the document or NULL if
......
......@@ -86,7 +86,7 @@ QString Movie::url() const
return d->m_url;
}
void Movie::setSize( const QSize &aspect )
void Movie::setSize( const QSize &aspect ) // clazy:exclude=function-args-by-value TODO remove the & when we do a BIC change elsewhere
{
d->m_aspect = aspect;
}
......
......@@ -62,7 +62,7 @@ class OKULARCORE_EXPORT Movie
/**
* Sets the size for the movie.
*/
void setSize( const QSize &aspect );
void setSize( const QSize &aspect ); // TODO remove the & when we do a BIC change elsewhere
/**
* Returns the size of the movie.
......
......@@ -70,7 +70,7 @@ KJSObject JSOCG::object( KJSContext *ctx )
return g_OCGProto->constructObject( ctx, nullptr );
}
KJSObject JSOCG::wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int &i, const int &j )
KJSObject JSOCG::wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int i, const int j )
{
QPair< int, int > *pair = new QPair< int ,int >( i, j );
g_OCGCache->insert( pair, model );
......
......@@ -21,7 +21,7 @@ class JSOCG
public:
static void initType( KJSContext *ctx );
static KJSObject object( KJSContext *ctx );
static KJSObject wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int &i, const int &j );
static KJSObject wrapOCGObject( KJSContext *ctx, QAbstractItemModel *model, const int i, const int j );
static void clearCachedFields();
};
......
......@@ -94,7 +94,7 @@ static bool segmentsOverlap(double left1, double right1, double left2, double ri
return false;
}
static bool doesConsumeY(const QRect& first, const QRect& second, int threshold)
static bool doesConsumeY(const QRect first, const QRect second, int threshold)
{
return segmentsOverlap(first.top(), first.bottom(), second.top(), second.bottom(), threshold);
}
......@@ -290,7 +290,7 @@ public:
{
};
RegionText(const WordsWithCharacters &wordsWithCharacters, const QRect &area)
RegionText(const WordsWithCharacters &wordsWithCharacters, const QRect area)
: m_region_wordWithCharacters(wordsWithCharacters), m_area(area)
{
}
......@@ -314,7 +314,7 @@ public:
return m_area;
}
inline void setArea(const QRect &area)
inline void setArea(const QRect area)
{
m_area = area;
}
......
......@@ -26,7 +26,7 @@
using namespace Okular;
QRect Utils::rotateRect( const QRect & source, int width, int height, int orientation )
QRect Utils::rotateRect( const QRect & source, int width, int height, int orientation ) // clazy:exclude=function-args-by-value TODO remove the & when we do a BIC change elsewhere
{
QRect ret;
......
......@@ -32,7 +32,7 @@ class OKULARCORE_EXPORT Utils
* Rotate the rect \p source in the area \p width x \p height with the
* specified \p orientation .
*/
static QRect rotateRect( const QRect & source, int width, int height, int orientation );
static QRect rotateRect( const QRect & source, int width, int height, int orientation ); // TODO remove the & when we do a BIC change elsewhere
/**
* Return the real DPI of the display containing given widget
......
......@@ -54,7 +54,7 @@ QDataStream &operator>>( QDataStream &s, Document &l )
return s;
}
QDataStream &operator<<( QDataStream &s, const Document &l )
QDataStream &operator<<( QDataStream &s, const Document l )
{
s << (short)l.docNumber;
s << (short)l.frequency;
......
......@@ -38,22 +38,22 @@ struct Document
{
Document( int d, int f ) : docNumber( d ), frequency( f ) {}
Document() : docNumber( -1 ), frequency( 0 ) {}
bool operator==( const Document &doc ) const
bool operator==( const Document doc ) const
{
return docNumber == doc.docNumber;
}
bool operator<( const Document &doc ) const
bool operator<( const Document doc ) const
{
return frequency > doc.frequency;
}
bool operator<=( const Document &doc ) const
bool operator<=( const Document doc ) const
{
return frequency >= doc.frequency;
}
bool operator>( const Document &doc ) const
bool operator>( const Document doc ) const
{
return frequency < doc.frequency;
}
......@@ -63,7 +63,7 @@ struct Document
};
QDataStream &operator>>( QDataStream &s, Document &l );
QDataStream &operator<<( QDataStream &s, const Document &l );
QDataStream &operator<<( QDataStream &s, const Document l );
class Index : public QObject
{
......@@ -124,4 +124,6 @@ class Index : public QObject
};
Q_DECLARE_TYPEINFO(QtAs::Document, Q_MOVABLE_TYPE);
#endif // EBOOK_SEARCH_INDEX_H
......@@ -26,7 +26,7 @@
#include <stdio.h>
QDebug &operator<<( QDebug & s, const ddjvu_rect_t &r )
QDebug &operator<<( QDebug & s, const ddjvu_rect_t r )
{
s.nospace() << "[" << r.x << "," << r.y << " - " << r.w << "x" << r.h << "]";
return s.space();
......
......@@ -42,7 +42,7 @@ class Anchor {
@param pg number of the page
@param _distance_from_top distance from the top of the page
*/
Anchor(const PageNumber& pg, const Length& _distance_from_top): page(pg), distance_from_top(_distance_from_top) {}
Anchor(const PageNumber pg, const Length _distance_from_top): page(pg), distance_from_top(_distance_from_top) {}
/** \brief quick validity check for anchors
......
......@@ -680,7 +680,7 @@ void dviRenderer::setResolution(double resolution_in_DPI)
}
void dviRenderer::handleSRCLink(const QString &linkText, const QPoint& point, DocumentWidget *widget)
void dviRenderer::handleSRCLink(const QString &linkText, const QPoint point, DocumentWidget *widget)
{
Q_UNUSED( linkText );
Q_UNUSED( point );
......
......@@ -46,7 +46,7 @@ extern const int MFResolutions[];
class DVI_SourceFileAnchor {
public:
DVI_SourceFileAnchor() {}
DVI_SourceFileAnchor(const QString& name, quint32 ln, quint32 pg, const Length& _distance_from_top)
DVI_SourceFileAnchor(const QString& name, quint32 ln, quint32 pg, const Length _distance_from_top)
: fileName(name), line(ln), page(pg),
distance_from_top(_distance_from_top) {}
......@@ -159,14 +159,14 @@ public Q_SLOTS:
void exportPS(const QString& fname = QString(), const QStringList& options = QStringList(), QPrinter* printer = nullptr, QPrinter::Orientation orientation = QPrinter::Portrait);
void exportPDF();
void handleSRCLink(const QString &linkText, const QPoint& point, DocumentWidget *widget);
void handleSRCLink(const QString &linkText, const QPoint point, DocumentWidget *widget);
void embedPostScript();
virtual void drawPage(RenderedDocumentPagePixmap* page);
virtual void getText(RenderedDocumentPagePixmap* page);
SimplePageSize sizeOfPage(const PageNumber& page);
SimplePageSize sizeOfPage(const PageNumber page);
const QVector<DVI_SourceFileAnchor>& sourceAnchors() { return sourceHyperLinkAnchors; }
......
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