Credo.Check.Readability.MaxFunctionLength (jetons v0.2.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

Functions should not exceed a maximum number of lines.

Long functions are harder to read, test, and maintain. If a function grows beyond the allowed line count, consider extracting helper functions.

Check-Specific Parameters

Use the following parameters to configure this check:

:max_line_count

The maximum number of lines a function body should have.

This parameter defaults to 15.

:ignore_comments

Whether to ignore comment lines when counting.

This parameter defaults to true.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.