#!/usr/bin/perl -w
#
# tests/python-lint.t

use Test::More qw( no_plan );

my %script_list = (
    'usr/bin/remctl-help' => [],
    );

for my $this_py (sort keys %script_list) {
    # flake8 test
    my $py  = "../${this_py}";
    if (! -e $py) {
        fail("File not found $py");
        next;
    }
    my $err     = 0;
    my $t2_name = $this_py . ' Tidy';
    my @cmd = ('flake8');
    if (scalar(@{ $script_list{$this_py} }) > 0) {
        push @cmd, @{ $script_list{$this_py} }, $py;
    } else {
        push @cmd, $py;
    }
    system(@cmd) == 0 or $err = 1;
    if ($err) {
        print('WARN: failing command: '. join(' ', @cmd) . "\n");
        fail($t2_name);
    } else {
        pass($t2_name);
    }
}
