Perl::...pNests(3pm)
okay bestie, welcome to this User Contributed Perl Documentation page β itβs the 3pm manual for Perl::Critic::Policy::ControlStructures::ProhibitDeepNests (the header labels it Perl::...pNests(3pm)), and it is literally here to tell you: donβt write deeply nested loops and conditionals π
β¨
π NAME π
Perl::Critic::Policy::ControlStructures::ProhibitDeepNestsβ Donβt write deeply nested loops and conditionals. periodt.
πΈ AFFILIATION πΈ
This Policy is part of the core Perl::Critic distribution. core fam π«Ά
π¦ DESCRIPTION π¦
Deeply nested code is often hard to understand and may be a sign that it needs to be refactored. no cap, your future self will thank you π
There are several good books on how to refactor code. The author says I like Martin Fowlerβs "Refactoring: Improving The Design of Existing Code". iconic pick tbh π
β¨ CONFIGURATION β¨
The maximum number of nested control structures can be configured via a value for max_nests in a .perlcriticrc file.
Each for-loop, if-else, while, and until block is counted as one nest. Postfix forms of these constructs are not counted. The default maximum is 5.
Customization in a .perlcriticrc file looks like this:
[ControlStructures::ProhibitDeepNests]
max_nests = 3
slay, now you can set your own vibe check on nesting depth π
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> wrote this one. icon behavior.
π COPYRIGHT π
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.
thatβs the whole page, bestie β from perl v5.42.0, dated 2024-10-23 π«Άπβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms