LogLevels solution accused of hardcoding test data
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the hardcoded-test-data warning using the LogLevels Java solution shown in the issue, then trace the analyzer rule that reports it. Determine whether the required log-level strings are being misclassified and verify that the diagnostic correctly handles this solution without suppressing genuine hardcoded test data.
Written by the indexing model from the issue text.
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?
- Dominant language
- Java
- Stars
- 13
- Forks
- 27
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from exercism/java-analyzer
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
exercism/java-analyzer#298 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
exercism/java-analyzer#227 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
exercism/java-analyzer#218 · 3 comments ·
-
x:size/small
exercism/java-analyzer#176 · 1 comment · 1 assignee ·
-
x:action/create x:knowledge/intermediate x:module/analyzer x:size/medium x:type/coding x:type/content
exercism/java-analyzer#170 · 13 comments · 1 assignee ·
All issues in exercism/java-analyzer
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100