tclint
is a lint tool for Tcl. It analyzes Tcl source files and reports issues that may cause bugs, inhibit readability, or affect performance.
- Checks for common Tcl errors
- Companion formatting utility,
tclfmt
- Usage checks for built-in commands
- Plugin system for usage checks of EDA tool-specific commands, including OpenROAD
- More coming soon!
Install tclint
from PyPI using pipx
(recommended):
pipx install tclint
Or with pip
:
pip install tclint
Run tclint
on a Tcl source file by providing its path as a positional argument:
tclint example.tcl
If the file contains any lint violations, they will be printed and tclint
will return a non-zero exit code. Otherwise, the output will be empty and tclint
will exit successfully.
$ cat example.tcl
if { [expr {$input > 10}] } {
puts $input is greater than 10!
}
$ tclint example.tcl
data/example.tcl:1:6: unnecessary command substitution within expression [redundant-expr]
data/example.tcl:2:3: too many args for puts: got 5, expected no more than 3 [command-args]
tclint
is a command-line utility. It takes a list of paths as positional arguments, which may either be direct paths to source files, or directories which will be recursively searched for files ending in .tcl
, .sdc
, .xdc
, or .upf
.
Collected files will be checked for lint violations. See the
Violations documentation page for a description of all
lint violations tclint
may report.
Aspects of tclint
's behavior can be controlled by a configuration file. By default, tclint
will look for a file named tclint.toml
or .tclint
in the current working directory (in that order), but a path to an alternate configuration file can be provided using the -c
or --config
flag. See Configuration for documentation on the configuration file.
tclint
includes a plugin system for checking EDA tool-specific commands. See the Plugins documentation page for more info.
tclint
welcomes community contributions. The best way to help the project is to open an issue if you find a bug or have a feature request.
PRs are also welcome, but for non-trivial changes please open an issue first to solicit feedback. This helps avoid wasted effort.
Use the following steps to set up tclint
for local development:
$ git clone https://github.com/nmoroze/tclint.git # or URL to fork
$ cd tclint
$ pip install -e .[dev]
Please format, lint, and run tests before submitting changes:
$ black --preview .
$ ./util/pre-commit
This project is copyright 2024 Noah Moroze, released under the MIT license.