A prompt is printed with IO.print right before IO.readln(), which takes the prompt as its argument

tx0/java:prompt-then-readlnstrictwarningstyle/conventionsdepth faststyle

What it finds

IO.print("Name: "); String name = IO.readln(); prints a prompt and then reads. IO.readln("Name: ") does both, and keeps the two from drifting apart.

Reported is a statement that only calls IO.print or IO.println with one argument, directly followed by a statement that calls IO.readln() without arguments.

From the rule's source, prompt_then_readln.rs.

Example from the rule's tests
class Prompt {  void run() {    IO.print("Name: ");tx0 reports: can print this prompt    String name = IO.readln();    IO.println(name);    IO.println("done");  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:prompt-then-readln" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:prompt-then-readln] reason="..."

tx0 explain tx0/java:prompt-then-readln shows the same in the terminal. Found a false positive? Report it.