feat: add support for .ipp and .ixx extensions (#3383)
This commit is contained in:
parent
94e8a69a9b
commit
aab5b39e2d
|
@ -971,8 +971,8 @@ void CmdLineParser::printHelp()
|
||||||
"Syntax:\n"
|
"Syntax:\n"
|
||||||
" cppcheck [OPTIONS] [files or paths]\n"
|
" cppcheck [OPTIONS] [files or paths]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"If a directory is given instead of a filename, *.cpp, *.cxx, *.cc, *.c++, *.c,\n"
|
"If a directory is given instead of a filename, *.cpp, *.cxx, *.cc, *.c++, *.c, *.ipp,\n"
|
||||||
"*.tpp, and *.txx files are checked recursively from the given directory.\n\n"
|
"*.ixx, *.tpp, and *.txx files are checked recursively from the given directory.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" --addon=<addon>\n"
|
" --addon=<addon>\n"
|
||||||
" Execute addon. i.e. --addon=cert. If options must be\n"
|
" Execute addon. i.e. --addon=cert. If options must be\n"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
QStringList FileList::getDefaultFilters()
|
QStringList FileList::getDefaultFilters()
|
||||||
{
|
{
|
||||||
QStringList extensions;
|
QStringList extensions;
|
||||||
extensions << "*.cpp" << "*.cxx" << "*.cc" << "*.c" << "*.c++" << "*.txx" << "*.tpp";
|
extensions << "*.cpp" << "*.cxx" << "*.cc" << "*.c" << "*.c++" << "*.txx" << "*.tpp" << "*.ipp" << "*.ixx";
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Dummy test file.
|
|
@ -0,0 +1 @@
|
||||||
|
Dummy test file.
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
void TestFileList::addFile()
|
void TestFileList::addFile()
|
||||||
{
|
{
|
||||||
// Accepted extensions: *.cpp, *.cxx, *.cc, *.c, *.c++, *.txx, *.tpp"
|
// Accepted extensions: *.cpp, *.cxx, *.cc, *.c, *.c++, *.txx, *.tpp, *.ipp, *.ixx"
|
||||||
FileList list;
|
FileList list;
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo1.cpp");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo1.cpp");
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo2.cxx");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo2.cxx");
|
||||||
|
@ -33,13 +33,15 @@ void TestFileList::addFile()
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo5.c++");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo5.c++");
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo6.txx");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo6.txx");
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo7.tpp");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo7.tpp");
|
||||||
|
list.addFile(QString(SRCDIR) + "/../data/files/foo8.ipp");
|
||||||
|
list.addFile(QString(SRCDIR) + "/../data/files/foo9.ixx");
|
||||||
QStringList files = list.getFileList();
|
QStringList files = list.getFileList();
|
||||||
QCOMPARE(files.size(), 7);
|
QCOMPARE(files.size(), 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFileList::addPathList()
|
void TestFileList::addPathList()
|
||||||
{
|
{
|
||||||
// Accepted extensions: *.cpp, *.cxx, *.cc, *.c, *.c++, *.txx, *.tpp"
|
// Accepted extensions: *.cpp, *.cxx, *.cc, *.c, *.c++, *.txx, *.tpp, *.ipp, *.ixx"
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
paths << QString(SRCDIR) + "/../data/files/foo1.cpp";
|
paths << QString(SRCDIR) + "/../data/files/foo1.cpp";
|
||||||
paths << QString(SRCDIR) + "/../data/files/foo2.cxx";
|
paths << QString(SRCDIR) + "/../data/files/foo2.cxx";
|
||||||
|
@ -48,10 +50,12 @@ void TestFileList::addPathList()
|
||||||
paths << QString(SRCDIR) + "/../data/files/foo5.c++";
|
paths << QString(SRCDIR) + "/../data/files/foo5.c++";
|
||||||
paths << QString(SRCDIR) + "/../data/files/foo6.txx";
|
paths << QString(SRCDIR) + "/../data/files/foo6.txx";
|
||||||
paths << QString(SRCDIR) + "/../data/files/foo7.tpp";
|
paths << QString(SRCDIR) + "/../data/files/foo7.tpp";
|
||||||
|
paths << QString(SRCDIR) + "/../data/files/foo8.ipp";
|
||||||
|
paths << QString(SRCDIR) + "/../data/files/foo9.ixx";
|
||||||
FileList list;
|
FileList list;
|
||||||
list.addPathList(paths);
|
list.addPathList(paths);
|
||||||
QStringList files = list.getFileList();
|
QStringList files = list.getFileList();
|
||||||
QCOMPARE(files.size(), 7);
|
QCOMPARE(files.size(), 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFileList::addFile_notexist()
|
void TestFileList::addFile_notexist()
|
||||||
|
@ -105,8 +109,10 @@ void TestFileList::filterFiles()
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo5.c++");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo5.c++");
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo6.txx");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo6.txx");
|
||||||
list.addFile(QString(SRCDIR) + "/../data/files/foo7.tpp");
|
list.addFile(QString(SRCDIR) + "/../data/files/foo7.tpp");
|
||||||
|
list.addFile(QString(SRCDIR) + "/../data/files/foo8.ipp");
|
||||||
|
list.addFile(QString(SRCDIR) + "/../data/files/foo9.ixx");
|
||||||
QStringList files = list.getFileList();
|
QStringList files = list.getFileList();
|
||||||
QCOMPARE(files.size(), 5);
|
QCOMPARE(files.size(), 7);
|
||||||
QDir dir(QString(SRCDIR) + "/../data/files");
|
QDir dir(QString(SRCDIR) + "/../data/files");
|
||||||
QString base = dir.canonicalPath();
|
QString base = dir.canonicalPath();
|
||||||
QVERIFY(!files.contains(base + "/foo1.cpp"));
|
QVERIFY(!files.contains(base + "/foo1.cpp"));
|
||||||
|
|
|
@ -195,6 +195,8 @@ bool Path::isCPP(const std::string &path)
|
||||||
extension == ".hh" ||
|
extension == ".hh" ||
|
||||||
extension == ".tpp" ||
|
extension == ".tpp" ||
|
||||||
extension == ".txx" ||
|
extension == ".txx" ||
|
||||||
|
extension == ".ipp" ||
|
||||||
|
extension == ".ixx" ||
|
||||||
getFilenameExtension(path) == ".C"; // In unix, ".C" is considered C++ file
|
getFilenameExtension(path) == ".C"; // In unix, ".C" is considered C++ file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ def unpack_package(work_path, tgz):
|
||||||
# Skip dangerous file names
|
# Skip dangerous file names
|
||||||
continue
|
continue
|
||||||
elif member.name.lower().endswith(('.c', '.cpp', '.cxx', '.cc', '.c++', '.h', '.hpp',
|
elif member.name.lower().endswith(('.c', '.cpp', '.cxx', '.cc', '.c++', '.h', '.hpp',
|
||||||
'.h++', '.hxx', '.hh', '.tpp', '.txx', '.qml')):
|
'.h++', '.hxx', '.hh', '.tpp', '.txx', '.ipp', '.ixx', '.qml')):
|
||||||
try:
|
try:
|
||||||
tf.extract(member.name)
|
tf.extract(member.name)
|
||||||
found = True
|
found = True
|
||||||
|
|
|
@ -22,7 +22,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
mVersionRe("^(master|main|your|head|[12].[0-9][0-9]?) (.*)"),
|
mVersionRe("^(master|main|your|head|[12].[0-9][0-9]?) (.*)"),
|
||||||
hFiles{"*.hpp", "*.h", "*.hxx", "*.hh", "*.tpp", "*.txx"},
|
hFiles{"*.hpp", "*.h", "*.hxx", "*.hh", "*.tpp", "*.txx", "*.ipp", "*.ixx"},
|
||||||
srcFiles{"*.cpp", "*.cxx", "*.cc", "*.c++", "*.C", "*.c", "*.cl"}
|
srcFiles{"*.cpp", "*.cxx", "*.cc", "*.c++", "*.C", "*.c", "*.cl"}
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
Loading…
Reference in New Issue