-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for formatting & format codebase (#63)
- Loading branch information
Showing
21 changed files
with
237 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Format & Type Check | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
formatting: | ||
runs-on: ubuntu-latest | ||
name: "Check code style" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Run ruff via nox | ||
run: | | ||
python -m pip install nox | ||
python -m nox -s format_check | ||
pyright: | ||
runs-on: ubuntu-latest | ||
name: "Type checking" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Run pyright via nox | ||
run: | | ||
python -m pip install nox | ||
python -m nox -s pyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
import nox | ||
from nox import options | ||
|
||
PROJECT_PATH = os.path.join(".", "src") | ||
SCRIPT_PATHS = [PROJECT_PATH, "noxfile.py"] | ||
|
||
options.sessions = ["format_fix", "pyright"] | ||
|
||
|
||
@nox.session() | ||
def format_fix(session: nox.Session) -> None: | ||
session.install("-r", "requirements_dev.txt") | ||
session.run("python", "-m", "ruff", "format", *SCRIPT_PATHS) | ||
session.run("python", "-m", "ruff", "check", *SCRIPT_PATHS, "--fix") | ||
|
||
|
||
@nox.session() | ||
def format_check(session: nox.Session) -> None: | ||
session.install("-r", "requirements_dev.txt") | ||
session.run("python", "-m", "ruff", "format", *SCRIPT_PATHS, "--check") | ||
session.run("python", "-m", "ruff", "check", *SCRIPT_PATHS) | ||
|
||
|
||
@nox.session() | ||
def pyright(session: nox.Session) -> None: | ||
session.install("-r", "requirements_dev.txt", "-r", "requirements.txt") | ||
session.run("pyright", *SCRIPT_PATHS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
aiohttp==3.10.10 | ||
aiohttp==3.11.11 | ||
fortune-python==1.1.1 | ||
hikari==2.1.0 | ||
hikari-arc==1.4.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
ruff==0.7.3 | ||
nox==2024.10.9 | ||
ruff==0.9.1 | ||
pre-commit==4.0.1 | ||
pyright==1.1.391 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.