mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C#: exclude parameterless constructors from DataFlowTargetApi
This commit is contained in:
@@ -30,6 +30,11 @@ private predicate isHigherOrder(CS::Callable api) {
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if the given API is a constructor without parameters. */
|
||||
private predicate isParameterlessConstructor(CS::Callable api) {
|
||||
api instanceof CS::Constructor and api.getNumberOfParameters() = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if it is relevant to generate models for `api`.
|
||||
*/
|
||||
@@ -38,7 +43,8 @@ private predicate isRelevantForModels(CS::Callable api) {
|
||||
api.getDeclaringType().getNamespace().getFullName() != "" and
|
||||
not api instanceof CS::ConversionOperator and
|
||||
not api instanceof Util::MainMethod and
|
||||
not api instanceof CS::Destructor
|
||||
not api instanceof CS::Destructor and
|
||||
not isParameterlessConstructor(api)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user