exercism / exercism/java-analyzer

LogLevels solution accused of hardcoding test data

Ouverte
#271 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
13
Forks
27
Merge moyen
4 j 9 h
PR mergées (30 j)
6

Description

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?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.