---
title: "max-control-nesting"
description: "Limit nested control structures."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# max-control-nesting

**Default severity:** `warning`

Reports control flow nested more than five levels deep. Guard clauses and
cohesive helper functions usually make the same decisions easier to follow.

## Bad

```go
if first {
	if second {
		if third {
			if fourth {
if fifth {
	if sixth {
		process()
	}
}
			}
		}
	}
}
```

## Good

```go
if !ready {
	return
}
for _, item := range items {
	process(item)
}
```

Source: https://strider.gempir.com/lints/max-control-nesting/index.mdx
