From e2f8d5078c4b0a1546b394c7bbd8dd1e12e5ca6a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 24 Jan 2024 14:12:45 +0100 Subject: [PATCH] Automatically format the code with ruff --- .github/workflows/formatter.yml | 11 +++++------ manage.py | 4 +--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 63f8b4215..78d46fb35 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -16,13 +16,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Get dependencies - run: pip install yapf isort + - name: Format the code + run: ruff format - - name: Format the code with yapf - run: yapf --recursive --in-place wger - - - name: Sort the imports with isort + # While ruff can also do some sorting, isort can still be configured to do more, + # like grouping imports, etc. + - name: Sort the imports run: isort . - name: Push a commit with the changed files diff --git a/manage.py b/manage.py index 5d93c5006..e716ec749 100644 --- a/manage.py +++ b/manage.py @@ -12,9 +12,7 @@ from wger.tasks import ( setup_django_environment, ) - -if __name__ == "__main__": - +if __name__ == '__main__': # If user passed the settings flag ignore the default wger settings if not any('--settings' in s for s in sys.argv): setup_django_environment(get_path('settings.py'))