Skip to content

Commit 25122c9

Browse files
committed
Python: Document (parts of) ExternalArtifact.qll.
I don't think there's any need to document the parts specific to metrics or defects, as I don't believe these are used anywhere.
1 parent 1e4ec5c commit 25122c9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

python/ql/src/external/ExternalArtifact.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes for working with external data.
3+
*/
4+
15
import python
26

37
class ExternalDefect extends @externalDefect {
@@ -27,23 +31,37 @@ class ExternalMetric extends @externalMetric {
2731
string toString() { result = getQueryPath() + ": " + getLocation() + " - " + getValue() }
2832
}
2933

34+
/**
35+
* An external data item.
36+
*/
3037
class ExternalData extends @externalDataElement {
38+
/** Gets the path of the file this data was loaded from. */
3139
string getDataPath() { externalData(this, result, _, _) }
3240

41+
/** Gets the path fo the file this data was loaded from, with its
42+
* extension replaced by `.ql`.
43+
*/
3344
string getQueryPath() { result = getDataPath().regexpReplaceAll("\\.[^.]*$", ".ql") }
3445

46+
/** Gets the number of fields in this data item. */
3547
int getNumFields() { result = 1 + max(int i | externalData(this, _, i, _) | i) }
3648

49+
/** Gets the value of the field at position `index` of this data item. */
3750
string getField(int index) { externalData(this, _, index, result) }
3851

52+
/** Gets the integer value of the field at position `index` of this data item. */
3953
int getFieldAsInt(int index) { result = getField(index).toInt() }
4054

55+
/** Gets the floating-point value of the field at position `index` of this data item. */
4156
float getFieldAsFloat(int index) { result = getField(index).toFloat() }
4257

58+
/** Gets the value of the field at position `index` of this data item, interpreted as a date. */
4359
date getFieldAsDate(int index) { result = getField(index).toDate() }
4460

61+
/** Gets a textual representation of this data item. */
4562
string toString() { result = getQueryPath() + ": " + buildTupleString(0) }
4663

64+
/** Gets a textual representation of this data item, starting with the field at position `start`. */
4765
private string buildTupleString(int start) {
4866
start = getNumFields() - 1 and result = getField(start)
4967
or

0 commit comments

Comments
 (0)