Skip to content

CSP gate fixture

Plain fenced block:

foreach ($orders as $order) {
if ($order->isActive()) {
array_map(function ($item) {
if ($item->qty > 0) {
return $item->qty > 10 ? 'bulk' : 'single';
}
}, $order->items());
}
}

With a title frame and line markers, the feature the scoring docs need:

orders.ts
for (const order of orders) {
if (order.isActive()) {
order.items().map((item) => {
if (item.qty > 0) {
return item.qty > 10 ? 'bulk' : 'single';
}
});
}
}

Terminal frame, as the landing page uses:

Terminal window
npx bonsai-lint --over 15 src/

Diff markers:

function score(node) {
let total = 0;
// [!code --]
total += node.children.length;
// [!code ++]
total += walk(node, 0);
return total;
}