exercism / exercism/java-analyzer

LogLevels solution accused of hardcoding test data

Aperta
#271 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
13
Fork
27
Merge medio
4g 9h
PR unite (30g)
6

Descrizione

I wrote the following code for LogLevels:

`public class LogLevels {

public static String message(String logLine) {
int colonIdx = logLine.indexOf(":");
return logLine.substring(colonIdx + 1).trim();
}

public static String logLevel(String logLine) {
if (logLine.contains("INFO")) {
return "info";
} else if (logLine.contains("WARNING")) {
return "warning";
} else {
return "error";
}
}

public static String reformat(String logLine) {
return message(logLine) + " (" + logLevel(logLine) + ")";
}
}
`

However, the editor keeps saying that I've hardcoded test data. I think it might be because of the specific log level strings that I'm looking for, but what's wrong with that?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.