Skip to content

Commit

Permalink
Fix analyzer RCS0056 - interpolated string (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Sep 15, 2024
1 parent d42621c commit 708be3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fix analyzer [RCS0053](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0053) ([PR](https://github.com/dotnet/roslynator/pull/1518))
- Fix analyzer [RCS0056](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0056) ([PR](https://github.com/dotnet/roslynator/pull/1521))

## [4.12.5] - 2024-09-13

Expand Down
1 change: 1 addition & 0 deletions src/Formatting.Analyzers/CSharp/LineIsTooLongAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private static void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
SyntaxKind.InterpolatedRawStringEndToken,
SyntaxKind.MultiLineRawStringLiteralToken,
#endif
SyntaxKind.InterpolatedStringTextToken,
SyntaxKind.InterpolatedStringEndToken))
{
SyntaxNode parent = token2.Parent;
Expand Down
18 changes: 18 additions & 0 deletions src/Tests/Formatting.Analyzers.Tests/RCS0056LineIsTooLongTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,24 @@ static void M(string x, int y)
0);
}
}
"""");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.LineIsTooLong)]
public async Task TestNoDiagnostic_LongRawStringLiteral2()
{
await VerifyNoDiagnosticAsync(""""
class C
{
void M()
{
string x = "x";
var value = $$"""
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
{{x}}
""";
}
}
"""");
}
}

0 comments on commit 708be3f

Please sign in to comment.