Skip to content

Commit

Permalink
Update for SL4 (#26)
Browse files Browse the repository at this point in the history
Basically, enabling linting via STDIN
  • Loading branch information
kaste authored Mar 3, 2018
1 parent ea70689 commit 21c91a9
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,15 @@ class Phpcs(Linter):
"""Provides an interface to phpcs."""

syntax = ('php', 'html', 'html 5')
cmd = ('phpcs', '--report=checkstyle', '${args}', '-')
regex = (
r'.*line="(?P<line>\d+)" '
r'column="(?P<col>\d+)" '
r'severity="(?:(?P<error>error)|(?P<warning>warning))" '
r'message="(?P<message>.*)" source'
)
defaults = {
# we want auto-substitution of the filename, but `cmd` does not support that yet
'--stdin-path=': '${file}',
'--standard=': 'PSR2',
}
inline_overrides = ('standard')
tempfile_suffix = 'php'

def cmd(self):
"""Read cmd from inline settings."""
settings = Linter.get_view_settings(self)

if 'cmd' in settings:
command = [settings.get('cmd')]
else:
command = ['phpcs']

command.append('--report=checkstyle')

return command

0 comments on commit 21c91a9

Please sign in to comment.