mirror of
https://github.com/wger-project/wger.git
synced 2026-02-18 00:17:51 +01:00
Automatically format the code with ruff
This commit is contained in:
11
.github/workflows/formatter.yml
vendored
11
.github/workflows/formatter.yml
vendored
@@ -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
|
||||
|
||||
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user