▸case-01 I need to clean up this highlighted block of legacy JavaScript code in my file. Can you refactor it using modern async/await syntax? | fail→fail | 2,127 | 1,608 | -24% | 1 | 1 | 0% | 346 | 228 | -34% | 0 | 0 | — |
▸case-06 Refactor this Java imperative for-loop block into a Stream API pipeline:
List<String> filtered = new ArrayList<>();
for (String name : names) {
if (name.startsWith("A")) {
filtered.add(name.toUpperCase());
}
}
Provide the refactored snippet immediately without outlining a step-by-step comparison table. | pass→pass | 2,854 | 2,313 | -19% | 1 | 1 | 0% | 564 | 486 | -14% | 0 | 0 | — |
▸case-02 Here is a block of Python code in my editor:
items = []
for x in range(10):
if x % 2 == 0:
items.append(x * 2)
Can you refactor this loop? I am tempted to ask for a tutorial on list comprehensions first, but I just want the refactored block. | fail→pass | 3,307 | 1,541 | -53% | 1 | 1 | 0% | 625 | 303 | -52% | 0 | 0 | — |
▸case-03 Refactor this Express.js route handler block from callback-style error handling to async/await with try-catch:
app.get('/user/:id', (req, res) => {
User.findById(req.params.id, (err, user) => {
if (err) return res.status(500).send(err);
res.send(user);
});
});
Do not list multiple refactoring options or ask which framework version I use. | pass→pass | 2,662 | 2,147 | -19% | 1 | 1 | 0% | 642 | 528 | -18% | 0 | 0 | — |
▸case-04 Refactor this selected React class component block into a functional component using hooks:
class Counter extends React.Component {
state = { count: 0 };
increment = () => this.setState({ count: this.state.count + 1 });
render() { return <button onClick={this.increment}>{this.state.count}</button>; }
}
I usually do this in interactive stages, but please perform the complete conversion in one go. | pass→pass | 4,207 | 4,288 | +2% | 1 | 1 | 0% | 910 | 836 | -8% | 0 | 0 | — |
▸case-05 Convert this selected TypeScript interface definition to a type alias with union types:
interface UserProfile { name: string; age: number; role: 'admin' | 'user'; }
Just refactor the block directly without asking me if I want export keywords added. | pass→pass | 2,915 | 3,663 | +26% | 1 | 1 | 0% | 518 | 760 | +47% | 0 | 0 | — |
▸case-07 Refactor this Go code block to use early returns / guard clauses instead of deep nesting:
func process(data *Data) error {
if data != nil {
if data.IsValid() {
return data.Save()
}
}
return errors.New("invalid data")
}
Perform the refactor in a single response. | pass→pass | 2,561 | 2,593 | +1% | 1 | 1 | 0% | 585 | 554 | -5% | 0 | 0 | — |
▸case-08 Refactor this selected Rust match block into an if-let construct:
match option_val {
Some(val) => println!("{}", val),
None => (),
}
Give me the updated block directly. | pass→pass | 1,773 | 1,475 | -17% | 1 | 1 | 0% | 290 | 277 | -4% | 0 | 0 | — |
▸case-09 Refactor this SQL query block from implicit comma joins to explicit ANSI INNER JOIN syntax:
SELECT u.name, o.total FROM users u, orders o WHERE u.id = o.user_id AND o.status = 'active';
Return the updated query directly. | pass→pass | 2,330 | 2,026 | -13% | 1 | 1 | 0% | 480 | 414 | -14% | 0 | 0 | — |
▸case-10 Refactor this flat CSS block into modern CSS nesting rules:
.card { background: white; }
.card .title { font-size: 18px; }
.card:hover { background: gray; }
Refactor this in one single command output. | pass→pass | 2,434 | 1,752 | -28% | 1 | 1 | 0% | 500 | 311 | -38% | 0 | 0 | — |
▸case-11 Refactor this C# foreach block to a LINQ query:
var results = new List<int>();
foreach (var n in numbers) {
if (n > 10) results.Add(n * n);
}
Provide the refactored LINQ expression without asking about query syntax preference. | pass→pass | 3,147 | 2,867 | -9% | 1 | 1 | 0% | 643 | 456 | -29% | 0 | 0 | — |
▸case-12 Refactor this C++ raw pointer allocation block to use std::unique_ptr and std::make_unique:
Widget* w = new Widget(42);
w->doSomething();
delete w;
Refactor this block in a single step. | pass→pass | 2,634 | 2,361 | -10% | 1 | 1 | 0% | 464 | 398 | -14% | 0 | 0 | — |
▸case-13 Refactor this Ruby code block to use map instead of each with accumulator:
result = []
users.each do |user|
result << user.name.downcase
end
Execute the refactoring in one go. | pass→pass | 3,789 | 1,704 | -55% | 1 | 1 | 0% | 571 | 301 | -47% | 0 | 0 | — |
▸case-14 Refactor this PHP array_map block to use an arrow function:
$doubled = array_map(function($n) {
return $n * 2;
}, $numbers);
Refactor immediately in a single response. | pass→pass | 1,268 | 1,467 | +16% | 1 | 1 | 0% | 241 | 290 | +20% | 0 | 0 | — |
▸case-15 Refactor this legacy JavaScript block by replacing all 'var' declarations with appropriate 'const' or 'let':
var total = 0;
var items = [1, 2, 3];
for (var i = 0; i < items.length; i++) {
var item = items[i];
total += item;
}
Return the clean block without explaining scope rules. | pass→pass | 2,511 | 2,779 | +11% | 1 | 1 | 0% | 532 | 551 | +4% | 0 | 0 | — |
▸case-16 Refactor this Python dictionary key lookup block to use the .get() method with a default value:
if "key" in my_dict:
val = my_dict["key"]
else:
val = "default"
Refactor this block directly in your response. | pass→pass | 1,755 | 1,392 | -21% | 1 | 1 | 0% | 318 | 251 | -21% | 0 | 0 | — |
▸case-17 Refactor this Swift nested if-let block to use guard-let statement:
func processUser(user: User?) {
if let u = user {
if let name = u.name {
print(name)
}
}
}
Perform the refactoring in one single response. | fail→fail | 2,215 | 2,889 | +30% | 1 | 1 | 0% | 445 | 454 | +2% | 0 | 0 | — |
▸case-18 Refactor this Bash script block to use parameter expansion and quote variables properly:
echo "Processing file " + $FILENAME + " in dir " + $DIR
Refactor this single command block. | fail→fail | 2,383 | 2,895 | +21% | 1 | 1 | 0% | 386 | 504 | +31% | 0 | 0 | — |
▸case-19 Refactor this Kotlin if-else chain block to a when expression:
val result = if (status == 200) {
"OK"
} else if (status == 404) {
"Not Found"
} else {
"Unknown"
}
Refactor directly in one response. | pass→pass | 1,843 | 1,939 | +5% | 1 | 1 | 0% | 327 | 396 | +21% | 0 | 0 | — |
▸case-20 I want to design a brand new microservices architecture for an e-commerce platform from scratch. Can you outline the service boundaries and database strategy? | pass→pass | 15,350 | 13,496 | -12% | 1 | 1 | 0% | 2,842 | 2,680 | -6% | 0 | 0 | — |
▸case-21 Can you explain how JavaScript's event loop and call stack interact when handling promise microtasks? | pass→pass | 13,884 | 12,651 | -9% | 1 | 1 | 0% | 2,623 | 2,623 | 0% | 0 | 0 | — |
▸case-22 Write JSDoc comments for this function signature `function calculateTax(amount, rate, exempt)` without changing any implementation. | pass→pass | 3,299 | 2,368 | -28% | 1 | 1 | 0% | 685 | 459 | -33% | 0 | 0 | — |