use tclint as parser / formatter

This commit is contained in:
2025-07-27 17:55:48 +02:00
parent c34dac847a
commit c6f0758b97
132 changed files with 10193 additions and 10794 deletions
@@ -0,0 +1 @@
pip
+112
View File
@@ -0,0 +1,112 @@
Metadata-Version: 2.4
Name: tclint
Version: 0.6.0
Summary: A CLI utility for linting and analyzing Tcl code.
Author-email: Noah Moroze <me@noahmoroze.com>
License: MIT License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ply==3.11
Requires-Dist: tomli~=2.0.1; python_version < "3.11"
Requires-Dist: pathspec==0.11.2
Requires-Dist: importlib-metadata==6.8.0
Requires-Dist: pygls==1.3.1
Requires-Dist: voluptuous==0.15.2
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-timeout; extra == "dev"
Requires-Dist: codespell; extra == "dev"
Requires-Dist: pytest-lsp; extra == "dev"
Dynamic: license-file
# tclint &nbsp; [![CI](https://github.com/nmoroze/tclint/actions/workflows/ci.yml/badge.svg)](https://github.com/nmoroze/tclint/actions/workflows/ci.yml)
`tclint` is a collection of modern dev tools for Tcl. It includes a linter, a formatter, and a language server that provides Tcl support to your editor of choice.
### Features
- [Editor integration][lsp] for VS Code, Neovim, and Emacs
- [Linting][violations] for common Tcl errors
- [Formatter][tclfmt] that enforces a consistent, readable style
- [Plugin system](docs/plugins.md) that supports Tcl variants
- [More features][features] coming soon!
## Getting Started
Install `tclint` from PyPI using [`pipx`](https://pypa.github.io/pipx/) (recommended):
```sh
pipx install tclint
```
Or with `pip`:
```sh
pip install tclint
```
Run `tclint` on a Tcl source file by providing its path as a positional argument:
```sh
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
```console
$ 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](docs/violations.md) 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](docs/configuration.md) for documentation on the configuration file.
`tclint` includes a plugin system for checking EDA tool-specific commands. See the [Plugins](docs/plugins.md) documentation page for more info.
## Contributing
`tclint` welcomes community contributions. The best way to help the project is to [open an issue](https://github.com/nmoroze/tclint/issues/new) 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:
```sh
$ 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:
```sh
$ black --preview .
$ ./util/pre-commit
```
## License
This project is copyright Noah Moroze, released under the [MIT license](LICENSE).
[vscode]: https://marketplace.visualstudio.com/items?itemName=nmoroze.tclint
[violations]: docs/violations.md
[lsp]: docs/lsp.md
[tclfmt]: docs/tclfmt.md
[features]: https://github.com/nmoroze/tclint/issues/91
+51
View File
@@ -0,0 +1,51 @@
../../bin/tclfmt.exe,sha256=8ZZ_4y2Bn-gjRcDczvxwNhwRfZ-MlnkLw5NSFVnorMI,108435
../../bin/tclint.exe,sha256=qChLBArPHW4hqqqd04-iDo9uoAQoNYKKCYZWdgaifhc,108435
../../bin/tclsp.exe,sha256=-GEYOcDbCgp7WBq2zcwTNxO7RM-3vBQUG62K2aqWuCY,108434
tclint-0.6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
tclint-0.6.0.dist-info/METADATA,sha256=FMBk7GnSMWPVKrjBqk6Lxu4Wyf0-xG-Fne14sDdfuvA,4061
tclint-0.6.0.dist-info/RECORD,,
tclint-0.6.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
tclint-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
tclint-0.6.0.dist-info/entry_points.txt,sha256=IKl_khZUS1DefUWuXWPY2cG0cLD1FRMh3qrhXIOy7O8,112
tclint-0.6.0.dist-info/licenses/LICENSE,sha256=PGii0wulXro34f25070gTG-JRGM-TAyXyKVObnNJU68,1055
tclint-0.6.0.dist-info/top_level.txt,sha256=_cnnEELsoakzUgD9HHdivUoNbpKG9tUGznWvbGLmHQM,7
tclint/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
tclint/__main__.py,sha256=b18i_1-ZvzsA-TjgZUbH7MNVwbmsoiqIXZrg0lUvJNI,64
tclint/__pycache__/__init__.cpython-311.pyc,,
tclint/__pycache__/__main__.cpython-311.pyc,,
tclint/__pycache__/_version.cpython-311.pyc,,
tclint/__pycache__/checks.cpython-311.pyc,,
tclint/__pycache__/comments.cpython-311.pyc,,
tclint/__pycache__/config.cpython-311.pyc,,
tclint/__pycache__/format.cpython-311.pyc,,
tclint/__pycache__/lexer.cpython-311.pyc,,
tclint/__pycache__/parser.cpython-311.pyc,,
tclint/__pycache__/syntax_tree.cpython-311.pyc,,
tclint/__pycache__/violations.cpython-311.pyc,,
tclint/_version.py,sha256=jF9TuoEIJRaca3ScKo6qaz6PzaMlu7jjuSQIrJ3nX4U,511
tclint/checks.py,sha256=u6EI1V0fNRhcFAGBeKdXlHrCHrOD0cUAyXpzYgzBcq8,6872
tclint/cli/__pycache__/tclfmt.cpython-311.pyc,,
tclint/cli/__pycache__/tclint.cpython-311.pyc,,
tclint/cli/__pycache__/tclsp.cpython-311.pyc,,
tclint/cli/__pycache__/utils.cpython-311.pyc,,
tclint/cli/tclfmt.py,sha256=jeVLuPkGUkTx2RTqmdcPZu13m7x43DQwlumXFwlL5oA,5517
tclint/cli/tclint.py,sha256=RYWm_41AUOdbY0fXOSkOy1-sMVYUmwPyRklG-DOa3dw,4488
tclint/cli/tclsp.py,sha256=martVsLCMZQKOg0WAZuWLJ8wO2wwh0LVVrkFcbLcFMY,14633
tclint/cli/utils.py,sha256=eaGUozjoyJecVOHMU_fFJWCv1JoNdH_eonj5os_6XB8,2924
tclint/commands/__init__.py,sha256=CQVM2J2JOIWkt8GIxbIeCIqQTBmuwKzVO6f1eguwix0,1113
tclint/commands/__pycache__/__init__.cpython-311.pyc,,
tclint/commands/__pycache__/builtin.cpython-311.pyc,,
tclint/commands/__pycache__/checks.cpython-311.pyc,,
tclint/commands/__pycache__/plugins.cpython-311.pyc,,
tclint/commands/__pycache__/schema.cpython-311.pyc,,
tclint/commands/builtin.py,sha256=ny6ERMBsqesK0ML46oVWwOlKuU4Wqq7G8NvkOQbn_Ec,36147
tclint/commands/checks.py,sha256=7ia0ZbhTLHvSbwVimU2wnEqB1SeRdyC40VMui8s7Z3I,8556
tclint/commands/plugins.py,sha256=OX42Dm9wXoGUnPUAr4PWj9zWBu7huz6O2YKEqlqprck,2640
tclint/commands/schema.py,sha256=nPXrgxOl5codb0RtRp-kUI85ML76ZF58eadGanZq3S8,979
tclint/comments.py,sha256=j50bULPa_l7yhHVJw2HJF0AQMP5_dOYtL78haMIw5kA,3019
tclint/config.py,sha256=-JM6DtkznWpnJ-wDKxc-uONGjBlmY1--73k-AmTnrZs,13801
tclint/format.py,sha256=DyYejVdV_gOFkbuo7U2DezoEz129hRHe5hbg61XMHWM,16799
tclint/lexer.py,sha256=I81EHH47no0ljjpfa0bHNTJrkZqGgU6-AgH0XeIK_5Q,6100
tclint/parser.py,sha256=fInbPEXRDfgAjf5DX8I7exQwJaRd4qk6FULO-eWVMeM,28223
tclint/syntax_tree.py,sha256=tfG4_Ff_AD_tGTHID_pW2Qdz7gRH-3NnfyK3hIj-zeg,11727
tclint/violations.py,sha256=g2nYpPViuxL6LqLL64_kkGzeGxpTZQ1L9z5jusBGFEA,1219
+5
View File
@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: setuptools (80.9.0)
Root-Is-Purelib: true
Tag: py3-none-any
@@ -0,0 +1,4 @@
[console_scripts]
tclfmt = tclint.cli.tclfmt:main
tclint = tclint.cli.tclint:main
tclsp = tclint.cli.tclsp:main
@@ -0,0 +1,8 @@
Copyright Noah Moroze
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
tclint