Travis: Check the naming conventions again

This commit is contained in:
Daniel Marjamäki 2019-07-15 20:58:07 +02:00
parent 8198bd5e8f
commit 7e3626c84e
4 changed files with 21 additions and 12 deletions

View File

@ -220,13 +220,14 @@ script:
- make -s -j2
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- cd ../
# self check
- ${CPPCHECK} --template=gcc -D__CPPCHECK__ --error-exitcode=1 --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --inline-suppr --suppressions-list=.travis_suppressions -itest/cli -itest/synthetic -itest/testsuites -iaddons -igui cli lib gui test tools -j 2
# self check lib/cli
- mkdir b1
- ${CPPCHECK} -j2 --template=gcc --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling cli lib
# check gui with qt settings
- ${CPPCHECK} --template=gcc -D__CPPCHECK__ -DQT_VERSION=0x050000 --library=qt --error-exitcode=1 -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling -j 2 gui/*.cpp --suppressions-list=.travis_suppressions -igui/test
# check naming conventions TODO this is temporarily disabled
# - ${CPPCHECK} -i gui/test -j 2 --dump -q gui lib
# - find lib gui -maxdepth 1 -name "*.dump" | xargs -n 1 -P 4 python addons/naming.py --private-member-variable='m[A-Z].*'
- mkdir b2
- ${CPPCHECK} -j2 --template=gcc --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ --enable=style,performance,portability,warning,internal --exception-handling gui/*.cpp
# self check test and tools
- ${CPPCHECK} -j2 --template=gcc -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling test/*.cpp tools
# Build gui
- cd ./gui
# clean rebuild

View File

@ -79,7 +79,7 @@
/*static*/ FILE* CppCheckExecutor::mExceptionOutput = stdout;
CppCheckExecutor::CppCheckExecutor()
: mSettings(nullptr), latestProgressOutputTime(0), mErrorOutput(nullptr), mShowAllErrors(false)
: mSettings(nullptr), mLatestProgressOutputTime(0), mErrorOutput(nullptr), mShowAllErrors(false)
{
}
@ -848,7 +848,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
}
if (settings.reportProgress)
latestProgressOutputTime = std::time(nullptr);
mLatestProgressOutputTime = std::time(nullptr);
if (!settings.outputFile.empty()) {
mErrorOutput = new std::ofstream(settings.outputFile);
@ -1016,13 +1016,13 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
{
(void)filename;
if (!latestProgressOutputTime)
if (!mLatestProgressOutputTime)
return;
// Report progress messages every 10 seconds
const std::time_t currentTime = std::time(nullptr);
if (currentTime >= (latestProgressOutputTime + 10)) {
latestProgressOutputTime = currentTime;
if (currentTime >= (mLatestProgressOutputTime + 10)) {
mLatestProgressOutputTime = currentTime;
// format a progress message
std::ostringstream ostr;

View File

@ -175,7 +175,7 @@ private:
/**
* Report progress time
*/
std::time_t latestProgressOutputTime;
std::time_t mLatestProgressOutputTime;
/**
* Output file name for exception handler

8
naming.json Normal file
View File

@ -0,0 +1,8 @@
{
"script": "addons/naming.py",
"args": [
"--private-member-variable=m[A-Z].*"
"--var=[a-z].*",
"--function=[a-z].*"
]
}