Skip to main content


Summary: Max file length exceeded

Category: Style


Excessively large policy files.


Splitting large policy files into smaller ones.


Putting too much logic into a single file makes your policy harder to browse, read and maintain. Splitting logic into several smaller files, and composing policy by proper use of packages and imports, highlights dependencies and makes it easier to reason about.

Note that even a single package may be split up across several files! This is sometimes useful when different features or functions belong in the same "group", but are not directly related to each other. An example of this could be having a single package for configuration split across different files for different parts or functions of that configuration.

As an added bonus, some tools — like Regal! — may even benefit from avoiding huge files as they process files in parallel and thus will be able to handle many smaller files faster than a few large ones.

Configuration Options

This linter rule provides the following configuration options:

# one of "error", "warning", "ignore"
level: error
# default limit is 500 lines
max-file-length: 500


If you think you've found a problem with this rule or its documentation, would like to suggest improvements, new rules, or just talk about Regal in general, please join us in the #regal channel in the Styra Community Slack!