Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
5 changes: 3 additions & 2 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

class Phpcs(ComposerLinter):
cmd = ('phpcs', '--report=emacs', '${args}', '-')
regex = r'^.*:(?P<line>[0-9]+):(?P<col>[0-9]+): (?:(?P<error>error)|(?P<warning>warning)) - (?P<message>.+)'
regex = r'^.*:(?P<line>[0-9]+):(?P<col>[0-9]+): (?:(?P<error>error)|(?P<warning>warning)) - (?P<message>(.(?!\(\S+\)$))+)( \((?P<code>\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}'
}