Repository navigation
Description
Feature Request: Add ChkTeX Linter for LaTeX Files
Summary
I'd like to contribute a ChkTeX linter plugin for LaTeX (.tex) files. ChkTeX finds typographic and stylistic errors in LaTeX documents and is widely used in the LaTeX community.
Current State
- I have a working implementation in my local trunk.yaml that uses regex output parsing
- The
latexfile type already exists inlinters/plugin.yaml - ChkTeX supports over 40 warnings and is configurable via
.chktexrc
Questions for the Team
1. Distribution Strategy
ChkTeX is typically installed via system package managers (brew, apt, pacman). I see two approaches used in your repo:
- Option A (System-only): Like
pragma-once- require system installation, no downloads section - Option B (Hosted binaries): Like
clang-tidy- trunk.io hosts prebuilt binaries
Which approach would be preferred for community-contributed linters?
2. CI Environment
Will trunk-io/plugins CI have ChkTeX available for testing, or should tests skip if ChkTeX isn't installed?
3. Future Binary Mirror
Would trunk.io be open to a future enhancement where I create a chktex-binaries GitHub repository with GitHub Actions to build cross-platform binaries? This would enable automatic downloads similar to clang-tidy.
Proposed Implementation
# linters/chktex/plugin.yaml
version: 0.1
lint:
definitions:
- name: chktex
files: [latex]
description: Finds typographic errors in LaTeX
commands:
- name: lint
output: regex
batch: true
read_output_from: stdout
parse_regex: (?P<path>.*):(?P<line>\d+):(?P<col>\d+):(?P<code>\d+):(?P<severity>\w+):(?P<message>.*)
run: |
sh -c 'chktex --quiet --verbosity=0 --format "%f:%l:%c:%n:%k:%m__NEWLINE__" ${target}'
success_codes: [0, 2, 3]
parser:
run: sed "s/__NEWLINE__/\n/g"
direct_configs: [.chktexrc]
issue_url_format: http://www.nongnu.org/chktex/ChkTeX_Manual.pdf
known_good_version: "1.7.9"
suggest_if: files_present
version_command:
parse_regex: ChkTeX v${semver}
run: chktex --versionKey Technical Notes
- ChkTeX binary only needs
libc,ncurses,pcre2- does NOT require a full TeX distribution - Exit codes: 0=clean, 2=warnings found, 3=errors found
- Uses custom format string for parseable output
Related Context
- ChkTeX Official Site
- ChkTeX 1.7.9 Manual
- Similar approach to j2kun/chktex-action GitHub Action
I'm happy to submit a PR once I have guidance on the distribution approach. Thank you!
Activity