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 - make -s -j2
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui # building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- cd ../ - cd ../
# self check # self check lib/cli
- ${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 - 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 # 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 - mkdir b2
# check naming conventions TODO this is temporarily disabled - ${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
# - ${CPPCHECK} -i gui/test -j 2 --dump -q gui lib # self check test and tools
# - find lib gui -maxdepth 1 -name "*.dump" | xargs -n 1 -P 4 python addons/naming.py --private-member-variable='m[A-Z].*' - ${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 # Build gui
- cd ./gui - cd ./gui
# clean rebuild # clean rebuild

View File

@ -79,7 +79,7 @@
/*static*/ FILE* CppCheckExecutor::mExceptionOutput = stdout; /*static*/ FILE* CppCheckExecutor::mExceptionOutput = stdout;
CppCheckExecutor::CppCheckExecutor() 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) if (settings.reportProgress)
latestProgressOutputTime = std::time(nullptr); mLatestProgressOutputTime = std::time(nullptr);
if (!settings.outputFile.empty()) { if (!settings.outputFile.empty()) {
mErrorOutput = new std::ofstream(settings.outputFile); mErrorOutput = new std::ofstream(settings.outputFile);
@ -1016,13 +1016,13 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
{ {
(void)filename; (void)filename;
if (!latestProgressOutputTime) if (!mLatestProgressOutputTime)
return; return;
// Report progress messages every 10 seconds // Report progress messages every 10 seconds
const std::time_t currentTime = std::time(nullptr); const std::time_t currentTime = std::time(nullptr);
if (currentTime >= (latestProgressOutputTime + 10)) { if (currentTime >= (mLatestProgressOutputTime + 10)) {
latestProgressOutputTime = currentTime; mLatestProgressOutputTime = currentTime;
// format a progress message // format a progress message
std::ostringstream ostr; std::ostringstream ostr;

View File

@ -175,7 +175,7 @@ private:
/** /**
* Report progress time * Report progress time
*/ */
std::time_t latestProgressOutputTime; std::time_t mLatestProgressOutputTime;
/** /**
* Output file name for exception handler * 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].*"
]
}