mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
C++: Silence alerts coming from CMake test compilation files
This commit is contained in:
28
cpp/ql/lib/semmle/code/cpp/ConfigurationTestFile.qll
Normal file
28
cpp/ql/lib/semmle/code/cpp/ConfigurationTestFile.qll
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Provides classes for identifying files that created to test the
|
||||
* build configuration. It is often desirable to exclude these files
|
||||
* from analysis.
|
||||
*/
|
||||
|
||||
import File
|
||||
|
||||
/**
|
||||
* A file created to test the system configuration.
|
||||
*/
|
||||
abstract class ConfigurationTestFile extends File { }
|
||||
|
||||
/**
|
||||
* A file created by CMake to test the system configuration.
|
||||
*/
|
||||
class CmakeTryCompileFile extends ConfigurationTestFile {
|
||||
CmakeTryCompileFile() {
|
||||
exists(Folder folder, Folder parent |
|
||||
folder = this.getParentContainer() and
|
||||
parent = folder.getParentContainer()
|
||||
|
|
||||
folder.getBaseName().matches("TryCompile-%") and
|
||||
parent.getBaseName() = "CMakeScratch" and
|
||||
parent.getParentContainer().getBaseName() = "CMakeFiles"
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user