Skip to content

Commit 9bfdf22

Browse files
authored
capture error code if the -s arg is used (#51)
1 parent f0bf60f commit 9bfdf22

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ Before using this plugin, ensure that `phpcs` is installed on your system, prefe
2121
- SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html
2222
- Linter settings: http://sublimelinter.com/en/latest/linter_settings.html
2323

24+
Use the `"args"` setting to configure the coding standard, and/or to display the sniff codes for each error:
25+
26+
```json
27+
{
28+
"args": [
29+
"--standard=PEAR", // code standard
30+
"-s" // display sniff codes
31+
]
32+
}
33+
```
34+
2435
### Per-project Standards
2536
You can set up your project settings to use a specific standard using the following:
2637

linter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
class Phpcs(ComposerLinter):
55
cmd = ('phpcs', '--report=emacs', '${args}', '-')
6-
regex = r'^.*:(?P<line>[0-9]+):(?P<col>[0-9]+): (?:(?P<error>error)|(?P<warning>warning)) - (?P<message>.+)'
6+
regex = r'^.*:(?P<line>[0-9]+):(?P<col>[0-9]+): (?:(?P<error>error)|(?P<warning>warning)) - (?P<message>(.(?!\(\S+\)$))+)( \((?P<code>\S+)\)$)?' # noqa: E501
77
defaults = {
88
'selector': 'source.php - text.blade, text.html.basic',
9-
# we want auto-substitution of the filename, but `cmd` does not support that yet
9+
# we want auto-substitution of the filename,
10+
# but `cmd` does not support that yet
1011
'--stdin-path=': '${file}'
1112
}

0 commit comments

Comments
 (0)