[pve-devel] [RFC v2 storage] smartctl: use json parsing

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 31 14:33:54 CEST 2021


did not looked at all, so just a single comment.

On 31.03.21 14:06, Stefan Reiter wrote:
>> +    my $wearout = 100.0 - $json_result->{nvme_smart_health_information_log}->{percentage_used} if !$healthonly;
> 
> too long even for my liking, needs a line break somewhere :)

Yeah, there's more to it...

1. I explicitly wrote a "Wrapping Post-If" section for the last time somebody
  (*wink*) used it: https://pve.proxmox.com/wiki/Perl_Style_Guide#Wrapping_Post-If

2. `my $foo = "bar" if !$baz` is a bug! From the s

    "Also remember that you must NOT use post if when declaring the variable for
     the first time with my!" 
    -- end of https://pve.proxmox.com/wiki/Perl_Style_Guide#Wrapping_Post-If
    
    As this is undefined behavior in perl:
    "The behaviour of a my, state, or our modified with a statement modifier
     conditional or loop construct (for example, my $x if ...) is undefined."
    -- https://perldoc.perl.org/perlsyn#Statement-Modifiers


So please use `perl -wc` and `perlcritic`, severity 5 must not warn/error 
on
anything with following rule set:
https://pve.proxmox.com/wiki/Perl_Style_Guide#Basic_Linting_with_perlcritic





More information about the pve-devel mailing list