Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for warnings #18

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ class Pyflakes(PythonLinter):
'selector': 'source.python'
}

def split_match(self, match):
# mark properly the type error message

error = super().split_match(match)
if not error['match']:
gorkicode marked this conversation as resolved.
Show resolved Hide resolved
return None

warning_msg_regex = r'''(?x)
\b(?:
used|
unused|
redefines|
shadowed|
(may\sbe)
)\b
'''

warning_msg_regex = re.compile(warning_msg_regex, 0)
gorkicode marked this conversation as resolved.
Show resolved Hide resolved

if warning_msg_regex.search(error['message']):
error['warning'] = 'warning'
gorkicode marked this conversation as resolved.
Show resolved Hide resolved
else:
error['error'] = 'error'
gorkicode marked this conversation as resolved.
Show resolved Hide resolved

return error

def reposition_match(self, line, col, match, vv):
if 'imported but unused' in match.message:
# Consider:
Expand Down