forked from oschwald/SublimeLinter-perlcritic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linter.py
36 lines (25 loc) · 894 Bytes
/
linter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Gregory Oschwald (based on linter by Aparajita Fishman)
# Copyright (c) 2013 Gregory Oschwald, Aparajita Fishman
#
# License: MIT
#
"""This module exports the PerlCritic linter class."""
import os
from SublimeLinter.lint import Linter, util
class PerlCritic(Linter):
"""Provides an interface to perlcritic."""
syntax = ('modernperl', 'perl')
executable = 'perlcritic'
regex = r'\[.+\] (?P<message>.+?) at line (?P<line>\d+), column (?P<col>\d+).+?'
def cmd(self):
"""Return a tuple with the command line to execute."""
command = [self.executable_path, '--verbose', '8']
config = util.find_file(
os.path.dirname(self.filename), '.perlcriticrc')
if config:
command += ['-p', config]
return command