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

Conversation

gorkicode
Copy link

Implemented split_match as was suggested by @kaste in #10 an issue started by YonatanAhituv

  • Added support for warnings

Copy link
Contributor

@kaste kaste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see some movement here. 👍

linter.py Outdated Show resolved Hide resolved
linter.py Outdated Show resolved Hide resolved
linter.py Outdated Show resolved Hide resolved
linter.py Outdated Show resolved Hide resolved
Copy link
Author

@gorkicode gorkicode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • removed: if not error['match']
  • re.compile moved into init()
  • new key error_type used

@gorkicode gorkicode marked this pull request as draft November 18, 2021 00:34
@@ -17,6 +17,30 @@ class Pyflakes(PythonLinter):
defaults = {
'selector': 'source.python'
}
warning_msg_regex = r'''(?x)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
warning_msg_regex = r'''(?x)
warning_msg_regex = r'''(?x)
warning_msg_regex = re.compile(r'''(?x)

We want to compile exactly once because the regex is static. Doing so in __init__ would still compile per linter run. You can do this either here as a class member or just in the global scope. Anyway, after that overriding __init__ should not be needed anymore.

self.warning_msg_regex = re.compile(self.warning_msg_regex, 0)

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

@kaste kaste Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the comment as it's clear what we're doing here. The comment is also not a sentence. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants