
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
36 lines
951 B
Plaintext
36 lines
951 B
Plaintext
include::../why-dotnet.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,csharp,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
void Regexes(string input)
|
|
{
|
|
var regex = new Regex("[A"); // Noncompliant
|
|
var match = Regex.Match(input, "[A"); // Noncompliant
|
|
var negativeLookahead = new Regex("a(?!b)", RegexOptions.NonBacktracking); // Noncompliant
|
|
var negativeLookbehind = new Regex("(?<!a)b", RegexOptions.NonBacktracking); // Noncompliant
|
|
}
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,csharp,diff-id=1,diff-type=compliant]
|
|
----
|
|
void Regexes(string input)
|
|
{
|
|
var regex = new Regex("[A-Z]");
|
|
var match = Regex.Match(input, "[A-Z]");
|
|
var negativeLookahead = new Regex("a(?!b)");
|
|
var negativeLookbehind = new Regex("(?<!a)b");
|
|
}
|
|
----
|
|
|
|
include::../resources-dotnet.adoc[]
|
|
|
|
include::../rspecator.adoc[]
|