-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathruff.py
More file actions
32 lines (23 loc) · 724 Bytes
/
Copy pathruff.py
File metadata and controls
32 lines (23 loc) · 724 Bytes
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
# -*- coding: utf-8 -*-
import re
import json
from validator import Validator
class Ruff(Validator):
__filetype__ = "python"
checker = "ruff"
args = "check --output-format json-lines"
def parse_loclist(self, loclist, bufnr):
lists = []
for i, l in enumerate(loclist):
try:
data = json.loads(l)
except Exception:
continue
loc = self.compose_loc(
i + 1, bufnr, 'W',
'({}) {}'.format(data['code'], data['message']),
data['location']['column']
)
loc['lnum'] = data['location']['row']
lists.append(loc)
return json.dumps(lists)