├── .github └── no-response.yml ├── .gitignore ├── .python-version ├── .travis.yml ├── LICENSE ├── README.md ├── linter.py ├── messages.json └── messages ├── 2.0.0.txt └── install.txt /.github/no-response.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-no-response - https://github.com/probot/no-response 2 | 3 | # Number of days of inactivity before an Issue is closed for lack of response 4 | daysUntilClose: 14 5 | # Label requiring a response 6 | responseRequiredLabel: "awaiting response" 7 | # Comment to post when closing an Issue for lack of response. Set to `false` to disable 8 | closeComment: > 9 | This issue has been automatically closed because there has been no response 10 | to our request for more information from the original author. With only the 11 | information that is currently in the issue, we don't have enough information 12 | to take action. Please reach out if you have or find the answers we need so 13 | that we can investigate further. 14 | -------------------------------------------------------------------------------- /.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-phplint 2 | ========================= 3 | 4 | [![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-phplint.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-phplint) 5 | 6 | This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [phplint](http://www.icosaedro.it/phplint/index.html). 7 | It will be used with files that have the "PHP", "HTML", or "HTML 5" 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 `phplint` (2.0 or later) is installed on your system. 17 | To install `phplint`, download and run the appropriate installer from the [download page](http://www.icosaedro.it/phplint/download.html). On Mac OS X, the best option is to install [Homebrew](http://brew.sh) and then enter the following in a terminal: 18 | 19 | ```sh 20 | brew install phplint 21 | ``` 22 | 23 | If installation via `brew` fails, see [this page](http://georgemastro.com/gcc-4-8-error-unrecognized-command-line-option-fnested-functions/) for possible solutions. 24 | 25 | Please make sure that the path to `phplint` is available to SublimeLinter. 26 | The docs cover [troubleshooting PATH configuration](http://sublimelinter.com/en/latest/troubleshooting.html#finding-a-linter-executable). 27 | 28 | 29 | ## Settings 30 | 31 | - SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html 32 | - Linter settings: http://sublimelinter.com/en/latest/linter_settings.html 33 | -------------------------------------------------------------------------------- /linter.py: -------------------------------------------------------------------------------- 1 | from SublimeLinter.lint import PhpLinter 2 | 3 | 4 | class PHPLint(PhpLinter): 5 | cmd = 'phpl --print-path relative --print-column-number --no-overall ${args} ${file}' 6 | regex = ( 7 | r'(?i)^(?:' 8 | r'\t.*?\r?\n)?' 9 | r'==== (?P\d+):(?P.*): ' 10 | r'(?:(?Perror)|(?Pwarning|notice)): ' 11 | r'(?P[^`\r\n]*(?:`(?P[^\']+)\')?[^\r\n]*)' 12 | ) 13 | multiline = True 14 | tempfile_suffix = '-' 15 | defaults = { 16 | 'selector': 'embedding.php, source.php' 17 | } 18 | 19 | def split_match(self, match): 20 | """Return the match with ` quotes transformed to '.""" 21 | match, line, col, error, warning, message, near = super().split_match(match) 22 | 23 | if message == 'no PHP code found at all': 24 | return None 25 | 26 | message = message.replace('`', '\'') 27 | 28 | # If the message contains a complaint about a function 29 | # and near looks like a function reference, remove the trailing 30 | # () so it can be found. 31 | if 'function \'' in message and near and near.endswith('()'): 32 | near = near[:-2] 33 | 34 | return match, line, col, error, warning, message, near 35 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt" 3 | } 4 | -------------------------------------------------------------------------------- /messages/2.0.0.txt: -------------------------------------------------------------------------------- 1 | SublimeLinter-phplint 2.0.0 2 | --------------------- 3 | 4 | SublimeLinter-phplint now requires atleast phplint version 2.0. 5 | 6 | If you are using an earlier version, you will need to upgrade it to 7 | continue using the newest version of SublimeLinter-phplint. 8 | 9 | Sorry for any inconvenience, and thanks for using SublimeLinter! 10 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | SublimeLinter-phplint 2 | ------------------------------- 3 | This linter plugin for SublimeLinter provides an interface to phplint. 4 | 5 | Please read the installation instructions at: 6 | 7 | https://github.com/SublimeLinter/SublimeLinter-phplint 8 | --------------------------------------------------------------------------------