diff --git a/.github/workflows/ruff.yaml b/.github/workflows/ruff.yaml new file mode 100644 index 00000000..730ab441 --- /dev/null +++ b/.github/workflows/ruff.yaml @@ -0,0 +1,11 @@ +name: Ruff +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 + with: + version: 0.4.2 + args: 'format --check' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..291c3bde --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.4.2 + hooks: + - id: ruff-format diff --git a/README.md b/README.md index 33302726..d9d223bd 100644 --- a/README.md +++ b/README.md @@ -276,4 +276,8 @@ As of right now, no. However, I _did_ have a CLI version in the recent past befo **Yes!!** I recommend taking a look at the [Priority Features](#priority-features), [Future Features](#future-features), and [Features I Won't Pull](#features-i-likely-wont-addpull) lists, as well as the project issues to see what’s currently being worked on. Please do not submit pull requests with new feature additions without opening up an issue with a feature request first. -As of writing I don’t have a concrete style guide, just try to stay within or close enough to the [PEP 8](https://peps.python.org/pep-0008/) style guide and/or match the style of the existing code. +Code formatting is automatically checked via [ruff](https://docs.astral.sh/ruff/). + +To format the code manually, install ruff via `pip install -r requirements-dev.txt` and then run `ruff format` + +To format the code automatically before each commit, there's a configured action available for `pre-commit` hook. Install it by running `pre-commit install`. The hook will be executed each time on running `git commit`. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..74f9591b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.ruff] +exclude = ["main_window.py", "home_ui.py"] diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..4745ae0c --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +ruff==0.4.2 +pre-commit==3.7.0