forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetaMetrics.qll
More file actions
26 lines (23 loc) · 759 Bytes
/
MetaMetrics.qll
File metadata and controls
26 lines (23 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* 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())
}
}