Skip to content

Instantly share code, notes, and snippets.

@timster
Created December 29, 2017 12:00
Show Gist options
  • Save timster/a6b8d01c864cf7ce7ad20ecb3f8d85b6 to your computer and use it in GitHub Desktop.
Save timster/a6b8d01c864cf7ce7ad20ecb3f8d85b6 to your computer and use it in GitHub Desktop.
from flake8.main.application import Application as Flake8
from myproject.app import create_app
# Code in this module gets run every time the app restarts in debug mode.
# Therefore the linter runs every time the app restarts.
CYAN = '\x1b[1;36m'
RED = '\x1b[0;31m'
RESET = '\x1b[0m'
FORMAT = CYAN + '%(path)s ' + RESET + '%(row)d:%(col)d ' + RED + '%(text)s' + RESET
CONFIG = {
'DEBUG': True,
}
linter = Flake8()
linter.initialize(['myproject', '--format=' + FORMAT])
linter.run_checks()
linter.report()
create_app(CONFIG).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment