Tests: Add lint-py checker

This commit is contained in:
Wilson Snyder 2022-09-07 22:04:57 -04:00
parent 361cef4633
commit 5a1bcf9794
2 changed files with 35 additions and 1 deletions

View File

@ -394,7 +394,7 @@ FLAKE8_FLAGS = \
--ignore=E123,E129,E251,E402,E501,W503,W504,E701
PYLINT = pylint
PYLINT_FLAGS = --disable=R0801
PYLINT_FLAGS = --score=n --disable=R0801
lint-py:
-$(FLAKE8) $(FLAKE8_FLAGS) $(PY_PROGRAMS)

View File

@ -0,0 +1,34 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2022 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(dist => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
my $cmd = "cd $root && make lint-py";
my $out = `$cmd`;
my $first;
foreach my $line (split /\n+/, $out) {
next if $line =~ /^---/;
next if $line =~ /^flake8/;
next if $line =~ /^pylint/;
print "$line\n";
if (!defined $first) {
$first = $line;
error("lint-py failed: ", $first);
}
}
}
ok(1);
1;