rspec/rules/S2788/java/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

36 lines
861 B
Plaintext

== Why is this an issue?
Different formatters use different formatting symbols, and it can be easy to confuse one for the other. But get it wrong, and your output may be useless.
This rule logs an issue when the wrong type of format string is used for Guava, slf4j, logback or ``++MessageFormat++`` strings.
=== Noncompliant code example
[source,java]
----
String message = MessageFormat.format("Now is the %s %d all good people", "time", 4); // Noncompliant
----
=== Compliant solution
[source,java]
----
String message = MessageFormat.format("Now is the {1} {2} all good people", "time", 4); // Noncompliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use "x" instead of "y" to format this [Guava|slf4j|logback|MessageFormat] message.
endif::env-github,rspecator-view[]