rspec/rules/S2479/java/rule.adoc

22 lines
587 B
Plaintext
Raw Normal View History

2020-06-30 12:48:07 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
String tabInside = "A B"; // Noncompliant, contains a tabulation
String zeroWidthSpaceInside = "foobar"; // Noncompliant, it contains a U+200B character inside
char tab = ' ';
----
== Compliant Solution
----
String tabInside = "A\tB"; // Compliant, uses escaped value
String zeroWidthSpaceInside = "foo\u200Bbar"; // Compliant, uses escaped value
char tab = '\t';
----
== Exceptions
Text Blocks string literals (java 13 three double-quote marks) can contain tabulations to allow indentation using tabulations.