Files
codeql/python/ql/src/meta/MetaMetrics.qll
Rasmus Wriedt Larsen d913d33289 Python: Autoformat
2020-07-14 11:21:55 +02:00

27 lines
759 B
Plaintext

/**
* Helpers for generating meta metrics, that is, metrics about the CodeQL analysis and extractor.
*/
import python
private import semmle.python.filters.GeneratedCode
private import semmle.python.filters.Tests
/**
* Gets the root folder of the snapshot.
*
* This is selected as the location for project-wide metrics.
*/
Folder projectRoot() { result.getRelativePath() = "" }
/** A file we ignore because it is a test file, part of a third-party library, or compiled/generated/bundled code. */
class IgnoredFile extends File {
IgnoredFile() {
any(TestScope ts).getLocation().getFile() = this
or
this instanceof GeneratedFile
or
// outside source root (inspired by `Scope.inSource`)
not exists(this.getRelativePath())
}
}