Help AI coding agents use Java Optional well in new code and cleanups, without replacing one antipattern with another.
100
100%
Does it follow best practices?
Impact
100%
2.08xAverage score across 4 eval scenarios
Passed
No known issues
{
"context": "Representative real-collection lookup case: the option set is real data and matching should stay centralized while the outer loop handles redact-next state.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Compiles and creates requested artifact",
"description": "Creates a coherent CommandSanitizer.java with sanitize(List<String>) and the required secret option set, using APIs compatible with the stated Java 17 baseline.",
"max_score": 5
},
{
"name": "Implements exact redaction behavior",
"description": "Preserves exact-option behavior such as --token abc -> --token <redacted>, adds option=value behavior such as --key=abc -> --key=<redacted>, and preserves non-secret arguments exactly.",
"max_score": 5
},
{
"name": "Preserves output order and sequence state",
"description": "Keeps output order, uses String.join(\" \", sanitized), and keeps redact-next behavior only for exact secret options.",
"max_score": 5
},
{
"name": "Keeps option matching centralized",
"description": "Keeps exact and option=value matching in one readable helper or direct lookup; a real Set stream, loop, or contains-based shape is acceptable when behavior remains clear.",
"max_score": 5
},
{
"name": "Consumes Optional result directly",
"description": "Handles the match result with map/orElse or another direct Optional boundary rather than isPresent()/get() or orElseThrow() value reads.",
"max_score": 45
},
{
"name": "Avoids fake or noisy rewrites",
"description": "Does not force a fake Optional collection, duplicate matching branches throughout the loop, local null sentinels, labels, or unnecessary nested loops.",
"max_score": 35
}
]
}