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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
# -*- encoding: ascii -*-
"""
Checking tasks
~~~~~~~~~~~~~~
"""
import invoke as _invoke
from . import clean as _clean
@_invoke.task(_clean.py)
def lint(ctx):
""" Run pylint """
pylint = ctx.shell.frompath('pylint')
if pylint is None:
raise RuntimeError("pylint not found")
with ctx.shell.root_dir():
ctx.run(ctx.c(
r''' %(pylint)s --rcfile pylintrc %(package)s ''',
pylint=pylint,
package=ctx.package
), echo=True)
@_invoke.task(_clean.py)
def flake8(ctx):
""" Run flake8 """
exe = ctx.shell.frompath('flake8')
if exe is None:
raise RuntimeError("flake8 not found")
with ctx.shell.root_dir():
ctx.run(ctx.c(
r''' %(flake8)s %(package)s.py ''',
flake8=exe,
package=ctx.package
), echo=True)
@_invoke.task(_clean.py)
def black(ctx):
"""Run black"""
exe = ctx.shell.frompath('black')
if exe is None:
raise RuntimeError("black not found")
with ctx.shell.root_dir():
ctx.run(
ctx.c(
'%s --check --config black.toml .',
exe,
ctx.package.replace('.', '/'),
),
echo=True,
)
@_invoke.task(lint, flake8, black, default=True)
def all(ctx): # pylint: disable = redefined-builtin, unused-argument
""" Run all """
|