From 6b086f405f3f32e2edad3f874071191e60f6c9b5 Mon Sep 17 00:00:00 2001 From: Kevin Lu <6320810+kevinlul@users.noreply.github.com> Date: Sat, 20 Jan 2024 21:52:21 -0500 Subject: [PATCH] Upload SARIF for Ruff --- .github/workflows/python.yml | 10 +++++++--- src/card.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 1d15251..a070183 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -28,7 +28,8 @@ jobs: # https://github.com/astral-sh/ruff ruff: runs-on: ubuntu-latest - permissions: {} + permissions: + security-events: write steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -36,7 +37,10 @@ jobs: python-version: "3.10" - run: pip install ruff - run: ruff format --check src - - run: ruff check src - if: ${{ !cancelled() }} - run: ruff check --output-format=github src if: ${{ !cancelled() }} + - run: ruff check --output-format=sarif src > ruff.sarif + - uses: github/codeql-action/upload-sarif@v3 + with: + category: ruff + sarif_file: ruff.sarif diff --git a/src/card.py b/src/card.py index 6b32c7d..b80a667 100644 --- a/src/card.py +++ b/src/card.py @@ -102,7 +102,7 @@ def generate_card_display(card: Any) -> str: if card.get("images"): image_link = f"https://yugipedia.com/wiki/Special:Redirect/file/{card['images'][0]['image']}?utm_source=bastion&utm_medium=reddit" links += f"[Card Image]({image_link}) | " - if card["konami_id"] != None: + if card["konami_id"] is not None: # Official database, does not work for zh locales official = f"https://www.db.yugioh-card.com/yugiohdb/card_search.action?ope=2&request_locale=en&cid={card['konami_id']}" rulings = f"https://www.db.yugioh-card.com/yugiohdb/faq_search.action?ope=4&request_locale=ja&cid={card['konami_id']}"