Python: Remove mutable default sources from inside stdlib

This commit is contained in:
Taus
2024-01-22 15:23:52 +00:00
parent 411c107660
commit 14c958ac4d
3 changed files with 6 additions and 20 deletions

View File

@@ -75,7 +75,11 @@ module ModificationOfParameterWithDefault {
class MutableDefaultValue extends Source {
boolean nonEmpty;
MutableDefaultValue() { nonEmpty = mutableDefaultValue(this.asCfgNode().(NameNode).getNode()) }
MutableDefaultValue() {
nonEmpty = mutableDefaultValue(this.asCfgNode().(NameNode).getNode()) and
// Ignore sources inside the standard library. These are unlikely to be true positives.
exists(this.getLocation().getFile().getRelativePath())
}
override boolean isNonEmpty() { result = nonEmpty }
}