├── .gitignore ├── .python-version ├── .travis.yml ├── LICENSE ├── README.md ├── linter.py ├── messages.json └── messages └── install.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.8 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.6" 4 | install: 5 | - pip install flake8 6 | script: 7 | - flake8 . --max-line-length=120 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SublimeLinter-chktex 2 | ========================= 3 | 4 | [![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-chktex.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-chktex) 5 | 6 | This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [ChkTeX](http://baruch.ev-en.org/proj/chktex/). 7 | It will be used with files that have use LaTeX (or LaTeXing) syntax. 8 | 9 | 10 | ## Installation 11 | 12 | SublimeLinter must be installed in order to use this plugin. 13 | 14 | Please use [Package Control](https://packagecontrol.io) to install the linter plugin. 15 | 16 | Before installing this plugin, ensure that `chktex` is installed on your system. 17 | ChkTeX is available on [CTAN](http://www.ctan.org/pkg/chktex) and comes with e.g. [TeX Live](http://www.tug.org/texlive/) starting with TeX Live 2011, and available for many platforms. 18 | 19 | If you are using a TeX distribution which does not include ChkTeX (for example MiKTeX) follow the instructions below to compile ChkTeX manually: 20 | 21 | 1. Make sure you don't have any [spaces in the path to MikTeX](http://stackoverflow.com/questions/30378183/cygwin-make-chktex-command-not-found) 22 | 23 | 2. Install [cygwin](http://cygwin.com/install.html) with the `make` and `gcc compiler` packages 24 | 25 | 3. Download [chktex](http://www.ctan.org/tex-archive/support/chktex) and save in home directory of cygwin (default is C:\cygwin\home\USER\) 26 | 27 | 4. In the cygwin bash, run 28 | ``` 29 | cd c: 30 | cd cygwin64/home/USER 31 | cd chktex-1.7.2 32 | configure 33 | make 34 | make install 35 | ``` 36 | 37 | 38 | 5. The resulting `chktex.exe` along with `cygwin1.dll` should now be saved in a directory which is registered in the PATH environment variable (for example %MiKTeX Install%\miktex\bin\ is appropriate) 39 | 40 | Please make sure that the path to `chktex` is available to SublimeLinter. 41 | The docs cover [troubleshooting PATH configuration](http://sublimelinter.com/en/latest/troubleshooting.html#finding-a-linter-executable). 42 | 43 | 44 | ## Settings 45 | 46 | - SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html 47 | - Linter settings: http://sublimelinter.com/en/latest/linter_settings.html 48 | 49 | By default, SublimeLinter-chktex ignores Warning 22 (Comment displayed) and Warning 30 (Multiple spaces detected in output). It also sets Warning 16 (Mathmode is still on at end of LaTeX file) as an error. 50 | 51 | Additional settings for SublimeLinter-chktex: 52 | 53 | - `nowarn`: A comma-separated list of warnings to ignore. 54 | - `erroron`: A comma-separated list of warnings to output as errors. 55 | -------------------------------------------------------------------------------- /linter.py: -------------------------------------------------------------------------------- 1 | from SublimeLinter.lint import Linter, util 2 | 3 | 4 | class Chktex(Linter): 5 | cmd = 'chktex -wall "-f%l:%c %k %k %n: %m\n"' 6 | error_stream = util.STREAM_STDOUT 7 | regex = ( 8 | r'^(?P\d+):(?P\d+) ' 9 | r'(?:(?PError)|(?PWarning)) ' 10 | r'(?P.+)' 11 | ) 12 | defaults = { 13 | 'selector': 'text.tex.latex - meta.block.parameters.knitr - source.r.embedded.knitr', 14 | '--nowarn:,+': [22, 30], 15 | '--erroron:,+': [16], 16 | '--inputfiles=': [0] 17 | } 18 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt" 3 | } 4 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | SublimeLinter-chktex 2 | ------------------------------- 3 | This linter plugin for SublimeLinter provides an interface to chktex. 4 | 5 | Please read the installation instructions at: 6 | 7 | https://github.com/SublimeLinter/SublimeLinter-chktex 8 | --------------------------------------------------------------------------------