Created
March 10, 2016 10:22
-
-
Save mr-karan/bd3234330ac099311406 to your computer and use it in GitHub Desktop.
Flake8Bear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from coalib.bearlib.abstractions.Lint import Lint | |
from coalib.bears.LocalBear import LocalBear | |
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY | |
class Flake8Bear(LocalBear, Lint): | |
executable = 'flake8' | |
output_regex = re.compile(r'^.+?:(?P<line>\d+):(?P<column>\d+):\s*(?:(?P<error>(?:F(?:40[24]|8(?:12|2[123]|31))|E(?:11[23]|90[12])))|(?P<warning>\w\d+))(?P<message>(?P<near>\'.+\')\s*imported but unused|.*)') | |
use_stdout = True | |
severity_map = { | |
"Warning": RESULT_SEVERITY.NORMAL, | |
"Error": RESULT_SEVERITY.MAJOR | |
} | |
def process_output(self, output, filename, file): | |
print(output) | |
def run(self, | |
filename, | |
file, | |
): | |
''' | |
Checks the code with `flake8` on each file separately. | |
:param htmllint_include: List of checkers to ignore. | |
''' | |
self.arguments = "{filename}" | |
return self.lint(filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@facebook.tokengetter | |
def get_facebook_oauth_token(): | |
return session.get('oauth_token') | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment