Skip to content

Commit 0de621e

Browse files
committed
Python: Add qldoc
1 parent 1903cb8 commit 0de621e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/ql/src/semmle/python/functions/ModificationOfParameterWithDefaultCustomizations.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ module ModificationOfParameterWithDefault {
139139
boolean isInverted() { result = inverted }
140140
}
141141

142+
/**
143+
* A check for the value being truthy or falsy can guard against modifying the default value.
144+
*/
142145
class IdentityGuard extends BarrierGuard {
143146
ControlFlowNode checked_node;
144147
boolean safe_branch;
@@ -149,7 +152,7 @@ module ModificationOfParameterWithDefault {
149152
exists(IdentityGuarded ig |
150153
this.getNode() = ig and
151154
checked_node = this and
152-
// The raw guard is true if the value is non-empty
155+
// The raw guard is true if the value is non-empty.
153156
// So we are safe either if we are looking for a non-empty value
154157
// or if we are looking for an empty value and the guard is inverted.
155158
safe_branch = ig.isInverted().booleanXor(nonEmpty)

0 commit comments

Comments
 (0)