diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-09-10 21:37:12 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-09-11 17:20:52 +0300 |
commit | 14ed433027623e1ae31f4f874605580c8191b27d (patch) | |
tree | 0778451ab7378fde0988a68d3b23ff3fc93b4724 | |
parent | Fix some clang-tidy warnings (diff) | |
download | rekonq-14ed433027623e1ae31f4f874605580c8191b27d.tar.xz |
Update cppcheck.sh
-rw-r--r-- | .cppcheck-suppressions | 6 | ||||
-rw-r--r-- | bitbucket-pipelines.yml | 22 | ||||
-rw-r--r-- | scripts/RekonqGitSvn.tailor | 17 | ||||
-rw-r--r-- | scripts/codingstyle.sh | 48 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/cppcheck.sh | 40 | ||||
-rw-r--r-- | scripts/download_i18n.sh | 120 | ||||
-rw-r--r-- | scripts/i18n.sh | 41 | ||||
-rw-r--r-- | src/tabbar/tabbar.cpp | 5 | ||||
-rw-r--r-- | src/urlbar/urlbar.cpp | 22 | ||||
-rw-r--r-- | src/urlbar/urlbar.hpp | 2 |
10 files changed, 25 insertions, 298 deletions
diff --git a/.cppcheck-suppressions b/.cppcheck-suppressions new file mode 100644 index 00000000..05959d49 --- /dev/null +++ b/.cppcheck-suppressions @@ -0,0 +1,6 @@ +missingIncludeSystem +unknownMacro +preprocessorErrorDirective:cmake-build-release/* +unusedFunction:src/tabbar/tabbar.cpp:71 +unusedFunction:src/urlbar/completer.cpp:43 +unusedFunction:plugins/* diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 81f0bdde..654fc772 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -31,12 +31,16 @@ pipelines: - cmake --preset debug -GNinja - cmake --build --preset debug - ctest --preset debug --output-junit test-results/all.xml - - step: - name: Release Build - runs-on: - - 'self.hosted' - - 'linux.shell' - script: - - git submodule update --init - - cmake --preset release -GNinja - - cmake --build --preset release + pull-requests: + '**': # for all branches + - step: + name: Release Build + runs-on: + - 'self.hosted' + - 'linux.shell' + script: + - git submodule update --init + - cmake --preset release -GNinja + - cmake --build --preset release + - clang-tidy -p cmake-build-release $(git diff origin/$BITBUCKET_PR_DESTINATION_BRANCH --name-only --diff-filter=AM | grep -E '\.(h|hpp|cpp)$') + - cppcheck --enable=all --suppressions-list=.cppcheck-suppressions --project=cmake-build-release/compile_commands.json --error-exitcode=1 diff --git a/scripts/RekonqGitSvn.tailor b/scripts/RekonqGitSvn.tailor deleted file mode 100644 index 5da56559..00000000 --- a/scripts/RekonqGitSvn.tailor +++ /dev/null @@ -1,17 +0,0 @@ -[DEFAULT] -verbose = True - -[project] -target = svn:target -start-revision = INITIAL -state-file = tailor.state -source = git:source -subdir = . - -[git:source] -repository = git@gitorious.org:rekonq/mainline.git - -[svn:target] -repository = svn+ssh://adjam@svn.kde.org/home/kde -module = /trunk/playground/network/rekonq2 - diff --git a/scripts/codingstyle.sh b/scripts/codingstyle.sh deleted file mode 100644 index b35d9433..00000000 --- a/scripts/codingstyle.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -# apply rekonq coding style to all cpp and header files in src directory -# -# requirements: installed astyle -# -# rekonq use kdelibs coding style, except for brackets, so while kdelibs coding style -# is -# -# void foo() { -# ... -# } -# -# rekonq uses -# -# void foo() -# { -# ... -# } -# -# I like this way, for me more readable. :) -# -# Kdelibs coding style is defined in http://techbase.kde.org/Policies/Kdelibs_Coding_Style - - -PWD=$(pwd) - -cd $PWD -cd .. - -echo "Applying astyle rules..." -astyle \ ---indent=spaces=4 \ ---style=allman \ ---indent-labels \ ---pad-oper \ ---pad-header \ ---unpad-paren \ ---keep-one-line-statements \ ---convert-tabs \ ---indent-preprocessor \ -`find -type f -name '*.cpp'` `find -type f -name '*.h'` - -echo "Removing .orig files..." -rm *.orig */*.orig - -echo "Done!" - diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh index be081040..91ab007e 100644..100755 --- a/scripts/cppcheck.sh +++ b/scripts/cppcheck.sh @@ -1,39 +1,9 @@ #!/bin/sh -# -# apply rekonq coding style to all cpp and header files in src directory -# -# requirements: installed astyle -# -# rekonq use kdelibs coding style, except for brackets, so while kdelibs coding style -# is -# -# void foo() { -# ... -# } -# -# rekonq uses -# -# void foo() -# { -# ... -# } -# -# I like this way, for me more readable. :) -# -# Kdelibs coding style is defined in http://techbase.kde.org/Policies/Kdelibs_Coding_Style +# inline suppressions are enabled: use // cppcheck-suppress warningId +# --inconclusive: possible false positives +# --force: force checking of all configurations in files +# --verbose: output more detailed error information -PWD=$(pwd) +cppcheck --enable=all --inline-suppr --project=cmake-build-debug/compile_commands.json -cd $PWD -cd .. -cd src - -echo "cppcheck(ing)..." -cppcheck \ ---enable=all \ ---force \ ---verbose \ -. 2>/tmp/cppcheck.out - -echo "DONE. read output in /tmp/cppcheck.out" diff --git a/scripts/download_i18n.sh b/scripts/download_i18n.sh deleted file mode 100644 index c26b35ab..00000000 --- a/scripts/download_i18n.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -# use this stupid script to just prepare rekonq -# dir with translations. -# -# 1. Update the lists of the ready (about 80%) translations -# check the situation here: http://l10n.kde.org/stats/gui/trunk-kde4/po/rekonq.po/ -LIST="af ar as ast az be be@latin bg bn bn_IN bo br bs ca ca@valencia crh cs csb -cy da de el en_GB eo es et eu fa fi fo fr fy ga gl gu ha he hi hne hr hsb hu hy -ia id is it ja ka kk km kn ko ku lb lo lt lv mai mi mk ml mn mr ms mt nb nds ne -nl nn nso oc or pa pl ps pt pt_BR ro ru rw se si sk sl sq sr sr@ijekavian -sr@ijekavianlatin sr@latin ss sv ta te tg th tr tt ug uk uz uz@cyrillic ven vi -wa xh zh_CN zh_HK zh_TW zu" - -# translation percentual -TRxCENT=80 - -# 2. run this script. It will create an i18n dir in rekonq sources ($RK_SRCS variable, set it to your source path) -# dir with all the listed translations (eg: italian translation = rekonq_it.po file) -# plus the CMakeLists.txt file needed to compile them. -RK_SRCS=/DATI/KDE/SRC/rekonq - -# 3. Uncomment the "ADD_SUBDIRECTORY( i18n )" line in main CMakeLists.txt file. - -# 4. test a package creation (to see the translations installed) - -# THAT's ALL!! - -######################################################################################################## - -# current dir -CWD=$(pwd) - -# fix language -export LANG=en_US.utf8 - -# create the i18n dir -cd $RK_SRCS -mkdir -p i18n -cd i18n - -# download the po files -for lang in $LIST -do - wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/$lang/messages/extragear-network/rekonq.po - - if [ -a rekonq.po ]; then - mv rekonq.po rekonq_$lang.po - - # retrieve the statistic string - STATS=$(msgfmt --statistic rekonq_$lang.po 2>&1) - rm messages.mo - - # grep out translated & untranslated strings number - TRANS=$(echo $STATS | awk '{print $1}') - TRANS=${TRANS:-0} - FUZZ=$(echo $STATS | awk '{print $4}') - FUZZ=${FUZZ:-0} - UNTR=$(echo $STATS | awk '{print $7}') - UNTR=${UNTR:-0} - - # check if perc is more than 80% - TOT=$[$TRANS+$FUZZ+$UNTR] - if [ $TOT -eq 0 ]; then - rm rekonq_$lang.po - else - PERC=$(echo $TRANS/$TOT | bc -l) - - RESULT=$(echo $PERC '>' .$TRxCENT | bc -l) - if [ $RESULT -eq 0 ]; then - echo removing $lang... - rm rekonq_$lang.po - fi - fi - fi -done - -# create the CMakeLists.txt file for the translations - - -echo ' - -FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) - -IF(NOT GETTEXT_MSGFMT_EXECUTABLE) - MESSAGE( -"------ - NOTE: msgfmt not found. Translations will *not* be installed -------") -ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE) - - SET(catalogname rekonq) - - ADD_CUSTOM_TARGET(translations ALL) - - FILE(GLOB PO_FILES ${catalogname}*.po) - - FOREACH(_poFile ${PO_FILES}) - GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME) - STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} ) - STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} ) - - IF( _langCode ) - GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE) - SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) - - ADD_CUSTOM_COMMAND(TARGET translations - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile} - DEPENDS ${_poFile}) - INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo) - ENDIF( _langCode ) - - ENDFOREACH(_poFile ${PO_FILES}) - -ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE) - -' > CMakeLists.txt - -# done :) -cd $CWD -echo "Done. Yuppy!" diff --git a/scripts/i18n.sh b/scripts/i18n.sh deleted file mode 100644 index e9b5444d..00000000 --- a/scripts/i18n.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /usr/bin/env bash - -BASEDIR="../src/" -PROJECT="rekonq" -BUGADDR="http://sourceforge.net/tracker/?group_id=252277&atid=1126949" -WDIR="../po/" - -cd ${BASEDIR} -echo "Preparing rc files" -find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | sort > ${WDIR}/rcfiles.list -xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp -cd ${WDIR} -echo "Done preparing rc files" - -echo "Extracting messages" -cd ${BASEDIR} -find . -name '*.cpp' -o -name '*.h' -o -name '*.c' | sort > ${WDIR}/infiles.list -echo "rc.cpp" >> ${WDIR}/infiles.list -cd ${WDIR} -xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \ - -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \ - --msgid-bugs-address="${BUGADDR}" \ - --files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "error while calling xgettext. aborting."; exit 1; } -echo "Done extracting messages" - -echo "Merging translations" -catalogs=`find . -name '*.po'` -for cat in $catalogs; do - echo $cat - msgmerge -o $cat.new $cat ${PROJECT}.pot - mv $cat.new $cat -done -echo "Done merging translations" - -echo "Cleaning up" -cd ${WDIR} -rm rcfiles.list -rm infiles.list -rm rc.cpp -echo "Done" - diff --git a/src/tabbar/tabbar.cpp b/src/tabbar/tabbar.cpp index fb5c0444..849dfbc1 100644 --- a/src/tabbar/tabbar.cpp +++ b/src/tabbar/tabbar.cpp @@ -10,11 +10,6 @@ #include "tabbar.h" -static inline QByteArray highlightPropertyName(int index) -{ - return QByteArray("hAnim").append(QByteArray::number(index)); -} - // ------------------------------------------------------------------------------------ TabBar::TabBar(QWidget *parent) : QTabBar(parent) diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index fcd9f7d3..18067f09 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -32,19 +32,6 @@ IconButton::IconButton(QWidget *parent) : QToolButton(parent) // ----------------------------------------------------------------------------------------------------------- -QString guessUrlWithCustomFirstLevel(const QString &str1, const QString &str2) -{ - QUrl url(QL1S("http://www.") + str1); - QString host = url.host().toLower(); - if (!host.endsWith(str2, Qt::CaseInsensitive)) { - host += str2; - url.setHost(host); - } - return url.toString(); -} - -// ----------------------------------------------------------------------------------------------------------- - UrlBar::UrlBar(QWidget *parent) : QLineEdit(parent), _icon(new IconButton(this)), backgroundColor{qApp->palette().color(QPalette::Base)}, highlightColor{qApp->palette().color(QPalette::Highlight)} @@ -198,7 +185,7 @@ void UrlBar::resizeEvent(QResizeEvent *event) _icon->move(c_iconMargin, iconHeight); for (int i = 0; i < iconsCount; ++i) { - IconButton *bt = _rightIconsList.at(i); + // IconButton *bt = _rightIconsList.at(i); // updateRightIconPosition(bt, i + 1); } @@ -749,10 +736,3 @@ void UrlBar::removeFromFavorites() } } */ - -void UrlBar::clearUrlbar() -{ - clear(); - // TODO: clearRightIcons(); - setFocus(); -} diff --git a/src/urlbar/urlbar.hpp b/src/urlbar/urlbar.hpp index 98e8368d..8be97838 100644 --- a/src/urlbar/urlbar.hpp +++ b/src/urlbar/urlbar.hpp @@ -54,8 +54,6 @@ public slots: */ // void manageBookmarks(); - void clearUrlbar(); - void loadRequestedUrl(const QUrl &url, rekonq::OpenType = rekonq::CurrentTab); void loadStarted(); |