Compare commits

...

1 Commits

Author SHA1 Message Date
Max Schaefer
c8b112da19 Automodel: Exclude features from Kotlin files. 2024-01-09 11:43:22 +00:00
8 changed files with 32 additions and 6 deletions

View File

@@ -89,6 +89,13 @@ abstract private class ApplicationModeEndpoint extends TApplicationModeEndpoint
}
abstract string toString();
/**
* Holds if this endpoint is from a Kotlin source file.
*/
predicate isInKotlinSourceFile() {
this.asNode().getLocation().getFile().isKotlinSourceFile()
}
}
/**

View File

@@ -79,7 +79,9 @@ where
CharacteristicsImpl::isModeled(endpoint, _, _, alreadyAiModeled)
) and
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, isVarargsArray) and
includeAutomodelCandidate(package, type, name, signature)
includeAutomodelCandidate(package, type, name, signature) and
// exclude features from Kotlin files since they are missing context regions
not endpoint.isInKotlinSourceFile()
select endpoint.asNode(),
"Related locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()), "CallContext", //

View File

@@ -61,7 +61,9 @@ where
confidence2 >= SharedCharacteristics::maximalConfidence() and
characteristic2.hasImplications(positiveType, true, confidence2)
) and
message = characteristic
message = characteristic and
// exclude features from Kotlin files since they are missing context regions
not endpoint.isInKotlinSourceFile()
select endpoint.asNode(),
message + "\nrelated locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()), "CallContext", //

View File

@@ -22,7 +22,9 @@ where
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, isVarargsArray) and
// Extract positive examples of sinks belonging to the existing ATM query configurations.
CharacteristicsImpl::isKnownAs(endpoint, endpointType, _) and
exists(CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext()))
exists(CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, CallContext())) and
// exclude features from Kotlin files since they are missing context regions
not endpoint.isInKotlinSourceFile()
select endpoint.asNode(),
endpointType + "\nrelated locations: $@, $@, $@." +
"\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", //

View File

@@ -88,6 +88,13 @@ abstract class FrameworkModeEndpoint extends TFrameworkModeEndpoint {
string toString() { result = this.asTop().toString() }
Location getLocation() { result = this.asTop().getLocation() }
/**
* Holds if this endpoint is in a Kotlin source file.
*/
predicate isInKotlinSourceFile() {
this.getLocation().getFile().isKotlinSourceFile()
}
}
class ExplicitParameterEndpoint extends FrameworkModeEndpoint, TExplicitParameter {

View File

@@ -38,7 +38,9 @@ where
CharacteristicsImpl::isSink(endpoint, _, alreadyAiModeled)
) and
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, parameterName) and
includeAutomodelCandidate(package, type, name, signature)
includeAutomodelCandidate(package, type, name, signature) and
// exclude features from Kotlin files since they are missing context regions
not endpoint.isInKotlinSourceFile()
select endpoint,
"Related locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", //

View File

@@ -34,7 +34,9 @@ where
confidence2 >= SharedCharacteristics::maximalConfidence() and
characteristic2.hasImplications(positiveType, true, confidence2)
) and
message = characteristic
message = characteristic and
// exclude features from Kotlin files since they are missing context regions
not endpoint.isInKotlinSourceFile()
select endpoint,
message + "\nrelated locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", //

View File

@@ -21,7 +21,9 @@ where
endpoint.getExtensibleType() = extensibleType and
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output, parameterName) and
// Extract positive examples of sinks belonging to the existing ATM query configurations.
CharacteristicsImpl::isKnownAs(endpoint, endpointType, _)
CharacteristicsImpl::isKnownAs(endpoint, endpointType, _) and
// exclude features from Kotlin files since they are missing context regions
not endpoint.isInKotlinSourceFile()
select endpoint,
endpointType + "\nrelated locations: $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
CharacteristicsImpl::getRelatedLocationOrCandidate(endpoint, MethodDoc()), "MethodDoc", //