Skip to content

interface-method-limit

Default severity: warning

Counts explicit and embedded methods after completing the interface. More than ten suggests an abstraction that may be easier to implement and test when split by responsibility.

type Service interface {
Start()
Stop()
Pause()
Resume()
Reload()
Status()
Health()
Metrics()
Configure()
Validate()
Reset()
}
type Reader interface {
Read([]byte) (int, error)
}

The default maximum is ten methods, including embedded methods.

[checks.rules.interface-method-limit]
max-methods = 12

Set max-methods = 0 to use the built-in maximum of ten.