pre-commit: Add config

This commit is contained in:
Jamie Gravendeel
2025-12-19 15:43:57 +01:00
parent eef38f73f5
commit b77d4ea9e8
7 changed files with 67 additions and 6 deletions

53
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,53 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: trailing-whitespace
- id: end-of-file-fixer
exclude_types: [svg]
- id: file-contents-sorter
files: po/LINGUAS|po/POTFILES\.in
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
hooks:
- id: ruff-check
args: [--select, I, --fix] # Only fix unsorted imports automatically
- id: ruff-check
- id: ruff-format
- repo: local
hooks:
- id: pyright
name: pyright
language: node
additional_dependencies: [pyright]
types_or: [python, pyi]
entry: pyright
- id: blueprint-format # https://gitlab.gnome.org/GNOME/blueprint-compiler/-/merge_requests/258
name: blueprint
language: system
files: \.blp$
entry: blueprint-compiler format --fix --no-diff
- id: meson-format
name: meson
language: python
files: meson\.build|meson\.options
entry: meson format --inplace
- id: prettier
name: prettier
language: node
additional_dependencies: [prettier]
types_or: [css, json, yaml]
entry: prettier --write
- id: svgo
name: svgo
language: node
additional_dependencies: [svgo]
types: [svg]
entry: svgo

View File

@@ -3,7 +3,7 @@
import sys
from gi.events import GLibEventLoopPolicy
from gi.events import GLibEventLoopPolicy # pyright: ignore[reportMissingImports]
from .application import Application

View File

@@ -3,8 +3,8 @@ python.install_sources(
'__init__.py',
'__main__.py',
'application.py',
'games.py',
'gamepads.py',
'games.py',
),
subdir: 'cartridges',
)

View File

@@ -130,7 +130,15 @@ template $Window: Adw.ApplicationWindow {
content: Adw.ToastOverlay toast_overlay {
child: Adw.ViewStack {
enable-transitions: true;
visible-child-name: bind $_if_else(grid.model as <NoSelection>.n-items, "grid", $_if_else(template.search-text, "empty-search", $_if_else(template.show-hidden, "empty-hidden", "empty") as <string>) as <string>) as <string>;
visible-child-name: bind $_if_else(
grid.model as <NoSelection>.n-items,
"grid",
$_if_else(
template.search-text,
"empty-search",
$_if_else(template.show-hidden, "empty-hidden", "empty") as <string>
) as <string>
) as <string>;
Adw.ViewStackPage {
name: "grid";

View File

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><g fill="#222"><path d="M1.5 2h13a1.5 1.5 0 0 1 0 3h-13a1.5 1.5 0 0 1 0-3M4.5 7h7a1.5 1.5 0 0 1 0 3h-7a1.5 1.5 0 0 1 0-3M7.5 12h1a1.5 1.5 0 0 1 0 3h-1a1.5 1.5 0 0 1 0-3m0 0"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="#222" d="M1.5 2h13a1.5 1.5 0 0 1 0 3h-13a1.5 1.5 0 0 1 0-3m3 5h7a1.5 1.5 0 0 1 0 3h-7a1.5 1.5 0 0 1 0-3m3 5h1a1.5 1.5 0 0 1 0 3h-1a1.5 1.5 0 0 1 0-3m0 0"/></svg>

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 256 B

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -6,8 +6,8 @@ cartridges/sources/steam.py
cartridges/ui/cover.blp
cartridges/ui/cover.py
cartridges/ui/game-details.blp
cartridges/ui/game_details.py
cartridges/ui/game-item.blp
cartridges/ui/game_details.py
cartridges/ui/game_item.py
cartridges/ui/shortcuts-dialog.blp
cartridges/ui/window.blp