diff --git a/README.md b/README.md index f58d5d6..387f3fa 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,17 @@ Before using this plugin, ensure that `phpcs` is installed on your system, prefe - SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html - Linter settings: http://sublimelinter.com/en/latest/linter_settings.html +Use the `"args"` setting to configure the coding standard, and/or to display the sniff codes for each error: + +```json +{ + "args": [ + "--standard=PEAR", // code standard + "-s" // display sniff codes + ] +} +``` + ### Per-project Standards You can set up your project settings to use a specific standard using the following: diff --git a/linter.py b/linter.py index 1bcabea..6748c2c 100644 --- a/linter.py +++ b/linter.py @@ -3,9 +3,10 @@ class Phpcs(ComposerLinter): cmd = ('phpcs', '--report=emacs', '${args}', '-') - regex = r'^.*:(?P[0-9]+):(?P[0-9]+): (?:(?Perror)|(?Pwarning)) - (?P.+)' + regex = r'^.*:(?P[0-9]+):(?P[0-9]+): (?:(?Perror)|(?Pwarning)) - (?P(.(?!\(\S+\)$))+)( \((?P\S+)\)$)?' # noqa: E501 defaults = { 'selector': 'source.php - text.blade, text.html.basic', - # we want auto-substitution of the filename, but `cmd` does not support that yet + # we want auto-substitution of the filename, + # but `cmd` does not support that yet '--stdin-path=': '${file}' }