Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comply with Perl:Critic policy Variables::RequireInitializationForLocalVars #2116

Closed
bschmalhofer opened this issue Jan 16, 2023 · 2 comments
Assignees
Labels
tidying Tidying of the code
Milestone

Comments

@bschmalhofer
Copy link
Contributor

This policy has been added to CodePolicy in https://github.com/RotherOSS/CodePolicy/issues/99.See also https://metacpan.org/pod/Perl::Critic::Policy::Variables::RequireInitializationForLocalVars .

@bschmalhofer bschmalhofer added the tidying Tidying of the code label Jan 16, 2023
@bschmalhofer bschmalhofer added this to the OTOBO 11.0 milestone Jan 16, 2023
@bschmalhofer bschmalhofer self-assigned this Jan 16, 2023
@bschmalhofer
Copy link
Contributor Author

A common usage is local *STDOUT; for temporarily overriding standard file handles. Rewriting that to local *STDOUT = undef emits a waring, https://perldoc.perl.org/perldiag#Undefined-value-assigned-to-typeglob. The alternative local *STDOUT = *funny_name is too strange. So let's settle with the a bit loss awkward local *STDOUT; ## no critic qw(Variables::RequireInitializationForLocalVars). Ultimately something like IO::Capture should be used for these cases.

bschmalhofer added a commit that referenced this issue Jan 16, 2023
…ocalVars

Either with a 'no critic' directive
or by assigning a value in same line as declaration with 'local'.
bschmalhofer added a commit that referenced this issue Jan 16, 2023
Issue #2116: avoid violations of Variables::RequireInitializationForL…
bschmalhofer added a commit that referenced this issue Jan 16, 2023
bschmalhofer added a commit that referenced this issue Jan 16, 2023
Issue #2116: avoid of assignments of undefined values
@bschmalhofer
Copy link
Contributor Author

CodePolicy is satisfied again, the test suite looks fine, closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tidying Tidying of the code
Projects
None yet
Development

No branches or pull requests

1 participant