Skip to content
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

Support new C#11 string types in CopyPasteTokenAnalyzer and TokenTypeAnalyzer #6204

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

csaba-sagi-sonarsource
Copy link
Contributor

No description provided.

@@ -40,7 +41,13 @@ protected override string GetCpdValue(SyntaxToken token)
{
return "$num";
}
else if (token.IsAnyKind(SyntaxKind.StringLiteralToken, SyntaxKind.InterpolatedStringTextToken))
else if (token.IsAnyKind(SyntaxKind.StringLiteralToken,
SyntaxKind.InterpolatedStringTextToken,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we subscribe here to InterpolatedStringTextToken but the following are missing:

  • InterpolatedSingleLineRawStringStartToken
  • InterpolatedMultiLineRawStringStartToken
    They are not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we only want to replace the "body" of the string with the $str. and not also the being and and tokens.

public void Aaa()
{
var x = 42;
var interpolatedWithWhitespaceToken = $"This literal should be $str but the whitespace between interpolation will not: {x} {x}";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this message is misleading, the space is actually a string. See:
image

@sonarcloud
Copy link

sonarcloud bot commented Oct 14, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Oct 14, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@costin-zaharia-sonarsource costin-zaharia-sonarsource merged commit 81a5847 into master Oct 14, 2022
@costin-zaharia-sonarsource costin-zaharia-sonarsource deleted the čaba/raw-string-literal-token branch October 14, 2022 08:33
@martin-strecker-sonarsource martin-strecker-sonarsource added this to the 8.47 milestone Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants