tb_lint package
Subpackages
- tb_lint.core package
- Submodules
- tb_lint.core.base_linter module
LinterResultLinterResult.linter_nameLinterResult.files_checkedLinterResult.files_failedLinterResult.violationsLinterResult.errorsLinterResult.linter_nameLinterResult.files_checkedLinterResult.files_failedLinterResult.violationsLinterResult.errorsLinterResult.error_countLinterResult.warning_countLinterResult.info_countLinterResult.add_violation()LinterResult.add_error()LinterResult.__init__()
BaseLinter
- tb_lint.core.base_rule module
RuleSeverityRuleViolationRuleViolation.fileRuleViolation.lineRuleViolation.columnRuleViolation.severityRuleViolation.messageRuleViolation.rule_idRuleViolation.contextRuleViolation.fileRuleViolation.lineRuleViolation.columnRuleViolation.severityRuleViolation.messageRuleViolation.rule_idRuleViolation.contextRuleViolation.__init__()
BaseRule
- tb_lint.core.config_manager module
- tb_lint.core.linter_registry module
- Module contents
BaseLinterLinterResultLinterResult.linter_nameLinterResult.files_checkedLinterResult.files_failedLinterResult.violationsLinterResult.errorsLinterResult.linter_nameLinterResult.files_checkedLinterResult.files_failedLinterResult.violationsLinterResult.errorsLinterResult.error_countLinterResult.warning_countLinterResult.info_countLinterResult.add_violation()LinterResult.add_error()LinterResult.__init__()
BaseRuleRuleViolationRuleViolation.fileRuleViolation.lineRuleViolation.columnRuleViolation.severityRuleViolation.messageRuleViolation.rule_idRuleViolation.contextRuleViolation.fileRuleViolation.lineRuleViolation.columnRuleViolation.severityRuleViolation.messageRuleViolation.rule_idRuleViolation.contextRuleViolation.__init__()
RuleSeverityLinterRegistryget_registry()register_linter()ConfigManager
- tb_lint.linters package
- tb_lint.rules package
- Subpackages
- tb_lint.rules.naturaldocs package
- Submodules
- tb_lint.rules.naturaldocs.class_docs module
- tb_lint.rules.naturaldocs.constraint_docs module
- tb_lint.rules.naturaldocs.file_header module
- tb_lint.rules.naturaldocs.function_docs module
- tb_lint.rules.naturaldocs.include_guards module
- tb_lint.rules.naturaldocs.package_docs module
- tb_lint.rules.naturaldocs.parameter_docs module
- tb_lint.rules.naturaldocs.task_docs module
- tb_lint.rules.naturaldocs.typedef_docs module
- tb_lint.rules.naturaldocs.variable_docs module
- Module contents
- tb_lint.rules.verible package
- tb_lint.rules.naturaldocs package
- Module contents
- Subpackages
Submodules
tb_lint.tb_lint module
Unified Linter - Modular Linting Framework
- Company: Copyright (c) 2025 BTA Design Services
Licensed under the MIT License.
Description: Flexible, plugin-based linting system supporting multiple linters
- Usage:
python3 tb_lint.py [options] <file.sv> [<file2.sv> …]
- Options:
- --help
Show this help message
- --config FILE
Configuration file (JSON)
- --linter NAME
Run specific linter (default: all)
- --list-linters
List available linters
- --strict
Treat warnings as errors
- --json
Output in JSON format
- --color
Enable colored output
- -f FILE_LIST
File containing list of files (one per line)
- -o OUTPUT_FILE
Output file for results
Examples
# Run all linters python3 tb_lint.py -f file_list.txt
# Run only NaturalDocs linter python3 tb_lint.py –linter naturaldocs file.sv
# Use custom config python3 tb_lint.py –config my_config.json -f files.txt
- class tb_lint.tb_lint.Colors[source]
Bases:
objectANSI color codes
- RED = '\x1b[0;31m'
- GREEN = '\x1b[0;32m'
- YELLOW = '\x1b[1;33m'
- BLUE = '\x1b[0;34m'
- CYAN = '\x1b[0;36m'
- BOLD = '\x1b[1m'
- NC = '\x1b[0m'
- class tb_lint.tb_lint.UnifiedLinter(config_file: str | None = None, use_color: bool = False, strict_mode: bool = False)[source]
Bases:
objectUnified linting orchestrator
Manages multiple linters and aggregates results
- __init__(config_file: str | None = None, use_color: bool = False, strict_mode: bool = False)[source]
Initialize unified linter
- Parameters:
config_file – Path to configuration file
use_color – Enable colored output
strict_mode – Treat warnings as errors
- run_linter(linter_name: str, file_paths: List[str]) LinterResult[source]
Run a specific linter on files
- Parameters:
linter_name – Name of linter to run
file_paths – List of files to check
- Returns:
LinterResult with violations found
- run_all_linters(file_paths: List[str]) dict[source]
Run all enabled linters on files
- Parameters:
file_paths – List of files to check
- Returns:
Dictionary mapping linter names to results
- print_result(result: LinterResult, output_file=None)[source]
Print linter results in human-readable format
- Parameters:
result – LinterResult to print
output_file – File handle for output (default: stdout)
- print_json(results: dict, output_file=None)[source]
Print results in JSON format
- Parameters:
results – Dictionary of linter results
output_file – File handle for output (default: stdout)
- print_command_info(args, files_to_check: List[str], output_file=None)[source]
Print command line information for tb_lint and each enabled linter
- Parameters:
args – Command line arguments
files_to_check – List of files to check
output_file – File handle for output (default: stdout)
tb_lint.verible_verilog_syntax module
Wrapper for verible-verilog-syntax --export_json
- class tb_lint.verible_verilog_syntax.PreOrderTreeIterator(tree: Node, filter_: Callable[[Node], bool] | None = None, reverse_children: bool = False)[source]
Bases:
_TreeIteratorBase
- class tb_lint.verible_verilog_syntax.PostOrderTreeIterator(tree: Node, filter_: Callable[[Node], bool] | None = None, reverse_children: bool = False)[source]
Bases:
_TreeIteratorBase
- class tb_lint.verible_verilog_syntax.LevelOrderTreeIterator(tree: Node, filter_: Callable[[Node], bool] | None = None, reverse_children: bool = False)[source]
Bases:
_TreeIteratorBase
- class tb_lint.verible_verilog_syntax.Node(parent: Node | None = None)[source]
Bases:
NodeMixinBase VeribleVerilogSyntax syntax tree node.
- property syntax_data: SyntaxData | None
Parent SyntaxData
- property start: int | None
Byte offset of node’s first character in source text
- property end: int | None
Byte offset of a character just past the node in source text.
- property text: str
Source code fragment spanning all tokens in a node.
- class tb_lint.verible_verilog_syntax.BranchNode(tag: str, parent: Node | None = None, children: List[Node] | None = None)[source]
Bases:
NodeSyntax tree branch node
- tag
Node tag.
- Type:
str
- property start: int | None
Byte offset of node’s first character in source text
- property end: int | None
Byte offset of a character just past the node in source text.
- iter_find_all(filter_: ~typing.Callable[[~tb_lint.verible_verilog_syntax.Node], bool] | ~typing.Dict[str, str | ~typing.List[str]] | None, max_count: int = 0, iter_: ~tb_lint.verible_verilog_syntax._TreeIteratorBase | ~anytree.iterators.abstractiter.AbstractIter = <class 'tb_lint.verible_verilog_syntax.LevelOrderTreeIterator'>, **kwargs) Iterable[Node][source]
Iterate all nodes matching specified filter.
- Parameters:
filter –
Describes what to search for. Might be: * Callable taking Node as an argument and returning True for accepted
nodes.
Dict mapping Node attribute names to searched value or list of searched values.
max_count – Stop searching after finding that many matching nodes.
iter – Tree iterator. Decides in what order nodes are visited.
- Yields:
Nodes matching specified filter.
- find(filter_: ~typing.Callable[[~tb_lint.verible_verilog_syntax.Node], bool] | ~typing.Dict[str, str | ~typing.List[str]] | None, iter_: ~tb_lint.verible_verilog_syntax._TreeIteratorBase | ~anytree.iterators.abstractiter.AbstractIter = <class 'tb_lint.verible_verilog_syntax.LevelOrderTreeIterator'>, **kwargs) Node | None[source]
Find node matching specified filter.
- Parameters:
filter –
Describes what to search for. Might be: * Callable taking Node as an argument and returning True for accepted
node.
Dict mapping Node attribute names to searched value or list of searched values.
iter – Tree iterator. Decides in what order nodes are visited.
- Returns:
First Node matching filter.
- find_all(filter_: ~typing.Callable[[~tb_lint.verible_verilog_syntax.Node], bool] | ~typing.Dict[str, str | ~typing.List[str]] | None, max_count: int = 0, iter_: ~tb_lint.verible_verilog_syntax._TreeIteratorBase | ~anytree.iterators.abstractiter.AbstractIter = <class 'tb_lint.verible_verilog_syntax.LevelOrderTreeIterator'>, **kwargs) List[Node][source]
Find all nodes matching specified filter.
- Parameters:
filter –
Describes what to search for. Might be: * Callable taking Node as an argument and returning True for accepted
nodes.
Dict mapping Node attribute names to searched value or list of searched values.
max_count – Stop searching after finding that many matching nodes.
iter – Tree iterator. Decides in what order nodes are visited.
- Returns:
List of nodes matching specified filter.
- class tb_lint.verible_verilog_syntax.RootNode(tag: str, syntax_data: SyntaxData | None = None, children: List[Node] | None = None)[source]
Bases:
BranchNodeSyntax tree root node.
- __init__(tag: str, syntax_data: SyntaxData | None = None, children: List[Node] | None = None)[source]
- property syntax_data: SyntaxData | None
Parent SyntaxData
- class tb_lint.verible_verilog_syntax.LeafNode(parent: Node | None = None)[source]
Bases:
NodeSyntax tree leaf node.
This specific class is used for null nodes.
- property start: None
Byte offset of token’s first character in source text
- property end: None
Byte offset of a character just past the token in source text.
- class tb_lint.verible_verilog_syntax.TokenNode(tag: str, start: int, end: int, parent: Node | None = None)[source]
Bases:
LeafNodeTree node with token data
Represents single token in a syntax tree.
- tag
Token tag.
- Type:
str
- property start: int
Byte offset of token’s first character in source text
- property end: int
Byte offset of a character just past the token in source text.
- class tb_lint.verible_verilog_syntax.Token(tag: str, start: int, end: int, syntax_data: SyntaxData | None = None)[source]
Bases:
objectToken data
Represents single token in tokens and rawtokens lists.
- tag
Token tag.
- Type:
str
- start
Byte offset of token’s first character in source text.
- Type:
int
- end
Byte offset of a character just past the token in source text.
- Type:
int
- syntax_data
Parent SyntaxData.
- Type:
Optional[“SyntaxData”]
- __init__(tag: str, start: int, end: int, syntax_data: SyntaxData | None = None)[source]
- property text: str
Token text in source code.
- class tb_lint.verible_verilog_syntax.Error(line: int, column: int, phase: str, message: str = '')[source]
Bases:
object- line: int
- column: int
- phase: str
- message: str = ''
- __init__(line: int, column: int, phase: str, message: str = '') None
- class tb_lint.verible_verilog_syntax.SyntaxData(source_code: str | None = None, tree: tb_lint.verible_verilog_syntax.RootNode | None = None, tokens: List[tb_lint.verible_verilog_syntax.Token] | None = None, rawtokens: List[tb_lint.verible_verilog_syntax.Token] | None = None, errors: List[tb_lint.verible_verilog_syntax.Error] | None = None)[source]
Bases:
object- source_code: str | None = None
- class tb_lint.verible_verilog_syntax.VeribleVerilogSyntax(executable: str = 'verible-verilog-syntax')[source]
Bases:
objectverible-verilog-syntaxwrapper.This class provides methods for running
verible-verilog-syntaxand transforming its output into Python data structures.- Parameters:
executable – path to
verible-verilog-syntaxbinary.
- parse_files(paths: List[str], options: Dict[str, Any] | None = None) Dict[str, SyntaxData][source]
Parse multiple SystemVerilog files.
- Parameters:
paths – list of paths to files to parse.
options –
dict with parsing options. Available options:
gen_tree (boolean): whether to generate syntax tree. skip_null (boolean): null nodes won’t be stored in a tree if True. gen_tokens (boolean): whether to generate tokens list. gen_rawtokens (boolean): whether to generate raw token list.
By default only
gen_treeis True.
- Returns:
A dict that maps file names to their parsing results in SyntaxData object.
- parse_file(path: str, options: Dict[str, Any] | None = None) SyntaxData | None[source]
Parse single SystemVerilog file.
- Parameters:
path – path to a file to parse.
options –
dict with parsing options. Available options:
gen_tree (boolean): whether to generate syntax tree. skip_null (boolean): null nodes won’t be stored in a tree if True. gen_tokens (boolean): whether to generate tokens list. gen_rawtokens (boolean): whether to generate raw token list.
By default only
gen_treeis True.
- Returns:
Parsing results in SyntaxData object.
- parse_string(string: str, options: Dict[str, Any] | None = None) SyntaxData | None[source]
Parse a string with SystemVerilog code.
- Parameters:
string – SystemVerilog code to parse.
options –
dict with parsing options. Available options:
gen_tree (boolean): whether to generate syntax tree. skip_null (boolean): null nodes won’t be stored in a tree if True. gen_tokens (boolean): whether to generate tokens list. gen_rawtokens (boolean): whether to generate raw token list.
By default only
gen_treeis True.
- Returns:
Parsing results in SyntaxData object.
Module contents
Unified Linter - Modular Linting Framework
- Company: Copyright (c) 2025 BTA Design Services
Licensed under the MIT License.
Description: Flexible, plugin-based linting system supporting multiple linters
- Usage:
python3 tb_lint.py [options] <file.sv> [<file2.sv> …]
- Options:
- --help
Show this help message
- --config FILE
Configuration file (JSON)
- --linter NAME
Run specific linter (default: all)
- --list-linters
List available linters
- --strict
Treat warnings as errors
- --json
Output in JSON format
- --color
Enable colored output
- -f FILE_LIST
File containing list of files (one per line)
- -o OUTPUT_FILE
Output file for results
Examples
# Run all linters python3 tb_lint.py -f file_list.txt
# Run only NaturalDocs linter python3 tb_lint.py –linter naturaldocs file.sv
# Use custom config python3 tb_lint.py –config my_config.json -f files.txt
- class tb_lint.Colors[source]
Bases:
objectANSI color codes
- RED = '\x1b[0;31m'
- GREEN = '\x1b[0;32m'
- YELLOW = '\x1b[1;33m'
- BLUE = '\x1b[0;34m'
- CYAN = '\x1b[0;36m'
- BOLD = '\x1b[1m'
- NC = '\x1b[0m'
- class tb_lint.UnifiedLinter(config_file: str | None = None, use_color: bool = False, strict_mode: bool = False)[source]
Bases:
objectUnified linting orchestrator
Manages multiple linters and aggregates results
- __init__(config_file: str | None = None, use_color: bool = False, strict_mode: bool = False)[source]
Initialize unified linter
- Parameters:
config_file – Path to configuration file
use_color – Enable colored output
strict_mode – Treat warnings as errors
- run_linter(linter_name: str, file_paths: List[str]) LinterResult[source]
Run a specific linter on files
- Parameters:
linter_name – Name of linter to run
file_paths – List of files to check
- Returns:
LinterResult with violations found
- run_all_linters(file_paths: List[str]) dict[source]
Run all enabled linters on files
- Parameters:
file_paths – List of files to check
- Returns:
Dictionary mapping linter names to results
- print_result(result: LinterResult, output_file=None)[source]
Print linter results in human-readable format
- Parameters:
result – LinterResult to print
output_file – File handle for output (default: stdout)
- print_json(results: dict, output_file=None)[source]
Print results in JSON format
- Parameters:
results – Dictionary of linter results
output_file – File handle for output (default: stdout)
- print_command_info(args, files_to_check: List[str], output_file=None)[source]
Print command line information for tb_lint and each enabled linter
- Parameters:
args – Command line arguments
files_to_check – List of files to check
output_file – File handle for output (default: stdout)