Skip to content

Commit

Permalink
add pylint_django migrations check
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnider2195 committed Oct 2, 2024
1 parent 8dcf01b commit 3963dd5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,21 @@ def hadolint(context):
@task
def pylint(context):
"""Run pylint code analysis."""
exit_code = 0

command = 'pylint --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml nautobot_dev_example'
run_command(context, command)
if not run_command(context, command, warn=True):
exit_code = 1

# run the pylint_django migrations checkers on the migrations directory
migrations_pylint = (
'pylint --verbose --init-hook "import nautobot; nautobot.setup()" --rcfile pyproject.toml '
"--load-plugins=pylint_django.checkers.migrations --disable=all --enable=new-db-field-with-default,missing-backwards-migration-callable nautobot_dev_example.migrations"
)
if not run_command(context, migrations_pylint, warn=True):
exit_code = 1

raise Exit(code=exit_code)


@task(aliases=("a",))
Expand Down

0 comments on commit 3963dd5

Please sign in to comment.