Internals: Add some missing Python files to lint

This commit is contained in:
Wilson Snyder 2025-11-22 12:22:39 -05:00
parent 44102de362
commit 3ab21332c9
4 changed files with 41 additions and 30 deletions

View File

@ -477,6 +477,12 @@ MAKE_FILES = \
src/Makefile*.in \
test_regress/Makefile* \
# Perl programs
PERL_PROGRAMS = \
bin/redirect \
bin/verilator \
bin/verilator_coverage \
# Python programs, subject to format and lint
PY_PROGRAMS = \
bin/verilator_ccache_report \
@ -484,25 +490,28 @@ PY_PROGRAMS = \
bin/verilator_gantt \
bin/verilator_includer \
bin/verilator_profcfunc \
examples/json_py/vl_file_copy \
examples/json_py/vl_hier_graph \
docs/guide/conf.py \
docs/bin/vl_sphinx_extract \
docs/bin/vl_sphinx_fix \
src/astgen \
src/bisonpre \
src/config_rev \
src/flexfix \
src/vlcovgen \
src/.gdbinit.py \
test_regress/*.py \
test_regress/t/*.pf \
docs/guide/conf.py \
examples/json_py/vl_file_copy \
examples/json_py/vl_hier_graph \
nodist/clang_check_attributes \
nodist/dot_importer \
nodist/fuzzer/actual_fail \
nodist/fuzzer/generate_dictionary \
nodist/install_test \
nodist/lint_py_test_filter \
nodist/log_changes \
nodist/uvm_pkg_packer \
nodist/verilator_saif_diff \
src/.gdbinit.py \
src/astgen \
src/bisonpre \
src/config_rev \
src/flexfix \
src/vlcovgen \
test_regress/*.py \
test_regress/t/*.pf \
# Python files, subject to format but not lint
PY_FILES = \

View File

@ -1,10 +1,9 @@
#!/usr/bin/env python3
# mypy: disallow-untyped-defs
# pylint: disable=
# pylint: disable=C0114,C0116
######################################################################
import argparse
import re
import sys
SUPPRESSES = [
@ -14,14 +13,15 @@ SUPPRESSES = [
"E0602: Undefined variable 'os' (undefined-variable)",
"E0602: Undefined variable 'glob' (undefined-variable)",
"W0611: Unused import vltest_bootstrap (unused-import)",
]
]
######################################################################
def process() -> None:
anymsg = False
for line in sys.stdin:
line = line.rstrip();
line = line.rstrip()
show = True
for msg in SUPPRESSES:
if msg in line:
@ -34,6 +34,7 @@ def process() -> None:
if anymsg:
sys.exit("%Error: See messages above")
#######################################################################
#######################################################################

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# mypy: disallow-untyped-defs
# pylint: disable=
# pylint: disable=C0114,C0116
######################################################################
import argparse
@ -12,7 +12,7 @@ import sys
def process() -> None:
in_header = True
in_backslash = False
in_backslash = None
for line in sys.stdin:
line = line.rstrip()
line = line.expandtabs(tabsize=8)
@ -23,9 +23,8 @@ def process() -> None:
if in_header:
if re.match(r'^//', line):
continue
else:
in_header = False
print_header()
in_header = False
print_header()
in_header = False
# Drop some unneeded items

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# pylint: disable=C0114,C0115,C0116,R0902,R0903,R0912,R0915,W0719,W0718
# pylint: disable=C0114,C0115,C0116,C0301,R0902,R0903,R0912,R0915,W0719,W0718
######################################################################
#
# Copyright 2025 by Wilson Snyder. This program is free software; you
@ -19,12 +19,12 @@ SIGNAL_TYPE = "SIGNAL"
EOF_ERROR = "Unexpected EOF"
def saif_assert(expression : bool, message : str) -> None:
def saif_assert(expression: bool, message: str) -> None:
if not expression:
raise Exception(message)
def saif_error(message : str) -> None:
def saif_error(message: str) -> None:
raise Exception(message)
@ -34,7 +34,7 @@ class SAIFSignalBit:
low_time: int
transitions: int
def __init__(self, name : str):
def __init__(self, name: str):
self.name = name
self.high_time = 0
self.low_time = 0
@ -43,7 +43,7 @@ class SAIFSignalBit:
class SAIFInstance:
def __init__(self, scope_name : str):
def __init__(self, scope_name: str):
self.scope_name = scope_name
self.parent_instance = None
self.nets = {}
@ -52,7 +52,7 @@ class SAIFInstance:
class SAIFToken:
def __init__(self, token : str):
def __init__(self, token: str):
self.token = token
self.type = ''
self.value = ''
@ -73,7 +73,7 @@ class SAIFParser:
self.divider = ''
self.timescale = ''
def parse(self, saif_filename : str) -> None:
def parse(self, saif_filename: str) -> None:
file_contents = ''
with open(saif_filename, 'r', encoding="utf8") as saif_file:
content = saif_file.readlines()
@ -225,9 +225,11 @@ def compare_saif_contents(first_file: str, second_file: str) -> int:
return SUCCESS_CODE
parser = argparse.ArgumentParser(allow_abbrev=False,
formatter_class=argparse.RawDescriptionHelpFormatter,
description="""verilator_saif_diff checks if two SAIF files are logically-identical. It returns first encountered difference as output.
parser = argparse.ArgumentParser(
allow_abbrev=False,
formatter_class=argparse.RawDescriptionHelpFormatter,
description=
"""verilator_saif_diff checks if two SAIF files are logically-identical. It returns first encountered difference as output.
Run as:
cd $VERILATOR_ROOT
nodist/code_coverage --first example.saif --second other.saif""")