Skip to main content

A CLI utility for linting and analyzing Tcl code.

Project description

tclint   CI

tclint is a lint tool for Tcl. It analyzes Tcl source files and reports issues that may cause bugs, inhibit readability, or affect performance.

Features

  • 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!

Getting Started

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.

Example

$ 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]

Usage

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.

Contributing

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

License

This project is copyright 2024 Noah Moroze, released under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tclint-0.5.0.tar.gz (68.6 kB view details)

Uploaded Source

Built Distribution

tclint-0.5.0-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file tclint-0.5.0.tar.gz.

File metadata

  • Download URL: tclint-0.5.0.tar.gz
  • Upload date:
  • Size: 68.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for tclint-0.5.0.tar.gz
Algorithm Hash digest
SHA256 f247d36262848d7d29ec772f6b23bb2e2400dee643db4b28c7670e2bb1d00eb6
MD5 301b7395d4180b780614565b73af4fc9
BLAKE2b-256 3a08fce8ce34343775cc7763478743a784aa8324b3e7493e78f2fd097fa643d0

See more details on using hashes here.

File details

Details for the file tclint-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: tclint-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 51.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for tclint-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a626c430c0d6003e42bcab53c5478b1c5311bd3cc3591079159f590e04d7188
MD5 8d9a8b13f026c6b3ee0d0aa1ba850f28
BLAKE2b-256 aa151af83a23ff9ba388691a872089a70d99ac9c5842358826229b62b1811df9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page