Add python linting in CI with Ruff. Fix the on: push/pull_request for other actions.

This commit is contained in:
Félix Piédallu 2024-03-14 13:08:31 +01:00
parent c4bccf86ed
commit 751ff67fd9
4 changed files with 36 additions and 7 deletions

View file

@ -3,6 +3,7 @@ on:
push:
branches:
- master
jobs:
black:
name: Check / auto apply black

25
.github/workflows/python_lint.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Python Ruff Lint and commit
on:
push:
branches: [master]
pull_request:
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install Ruff
run: pip install ruff
- name: Ruff check and fix
run: |
ruff check .
ruff fix .
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Python style fixes from Ruff'

View file

@ -2,6 +2,7 @@ name: Run Shellcheck on push and PR
on:
push:
branches: [master]
pull_request:
jobs:

View file

@ -1,13 +1,14 @@
#!/usr/bin/python3
import sys
import os
import json
import toml
import yaml
import os
import sys
import time
from collections import OrderedDict
import toml
import yaml
CATALOG_LIST_PATH = "/etc/yunohost/apps_catalog.yml"
assert os.path.exists(
CATALOG_LIST_PATH
@ -44,7 +45,8 @@ def build(folder=DEFAULT_APPS_FOLDER):
apps[app_dict["id"]] = app_dict
# We also remove the app install question and resources parts which aint needed anymore by webadmin etc (or at least we think ;P)
# We also remove the app install question and resources parts which aint needed
# anymore by webadmin etc (or at least we think ;P)
for app in apps.values():
if "manifest" in app and "install" in app["manifest"]:
del app["manifest"]["install"]