Skip to content

C#: Change the printed information in the Flow summaries tests. #16513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,13 @@ string asPartialModel(UnboundCallable c) {
)
}

/** Computes the first 4 columns for neutral CSV rows of `c`. */
string asPartialNeutralModel(UnboundCallable c) {
/**
* Gets the signature of `c` in the format `namespace;type;name;parameters`.
*/
string getSignature(UnboundCallable c) {
exists(string namespace, string type, string name, string parameters |
partialModel(c, namespace, type, name, parameters) and
partialModel(c, namespace, type, name, parameters)
|
result =
namespace + ";" //
+ type + ";" //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ class TargetApiSpecific extends CS::Callable {

predicate asPartialModel = ExternalFlow::asPartialModel/1;

predicate asPartialNeutralModel = ExternalFlow::asPartialNeutralModel/1;
/** Computes the first 4 columns for neutral CSV rows of `c`. */
predicate asPartialNeutralModel = ExternalFlow::getSignature/1;

/**
* Holds if `t` is a type that is generally used for bulk data in collection types.
Expand Down
36,161 changes: 18,077 additions & 18,084 deletions csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import semmle.code.csharp.dataflow.internal.ExternalFlow
final private class NeutralCallableFinal = NeutralCallable;

class RelevantNeutralCallable extends NeutralCallableFinal {
final string getCallableCsv() { result = asPartialNeutralModel(this) }
final string getCallableCsv() { result = getSignature(this) }
}

class RelevantSourceCallable extends SourceCallable {
string getCallableCsv() { result = asPartialModel(this) }
string getCallableCsv() { result = getSignature(this) }
}

class RelevantSinkCallable extends SinkCallable {
string getCallableCsv() { result = asPartialModel(this) }
string getCallableCsv() { result = getSignature(this) }
}

import TestSummaryOutput<IncludeSummarizedCallable>
Expand Down
29,646 changes: 14,821 additions & 14,825 deletions csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion csharp/ql/test/shared/FlowSummaries.qll
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class IncludeSummarizedCallable extends SummarizedCallableImplFinal {
}

/** Gets a string representing the callable in semi-colon separated format for use in flow summaries. */
final string getCallableCsv() { result = asPartialModel(this) }
final string getCallableCsv() { result = getSignature(this) }

predicate relevantSummary(
SummaryComponentStack input, SummaryComponentStack output, boolean preservesValue
Expand Down