From d850d500457c27cb74be9fd5a6d68dca2d496bb5 Mon Sep 17 00:00:00 2001 From: Phillip Cohen Date: Sat, 14 Feb 2026 10:51:16 -0800 Subject: [PATCH] Replace flynt with ruff FLY rules and bump pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove flynt hook; ruff's FLY002 + existing UP031/UP032 rules cover the same f-string conversions - Bump hook versions: pre-commit-hooks v4.4.0→v6.0.0, Lucas-C v1.5.1→v1.5.6, ruff v0.4.1→v0.15.1 - Bump minimum_pre_commit_version to 3.2.0 (required by pre-commit-hooks v6) - Add FLY to ruff select, add UP045 to ignore (same Talon runtime issue as UP007; see talonvoice/talon#634) - Apply ruff autofixes: SIM905 in default_vocabulary.py, C420 in destinations.py Closes #2308, closes #1885 --- .pre-commit-config.yaml | 12 ++---- .../src/default_vocabulary.py | 42 ++++++++++++++++++- .../src/cheatsheet/sections/destinations.py | 2 +- pyproject.toml | 4 +- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d28d21b50..488dfdbca6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -minimum_pre_commit_version: "2.9.0" +minimum_pre_commit_version: "3.2.0" ci: autoupdate_schedule: monthly exclude: /vendor/|^data/playground/ @@ -15,11 +15,11 @@ repos: language: fail types: [symlink] - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.1 + rev: v1.5.6 hooks: - id: forbid-crlf - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -71,12 +71,8 @@ repos: files: ^data/fixtures/recorded/.*/[^/]*\.yml$ language: system entry: pnpm exec ./packages/common/scripts/my-ts-node.js packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts --check-marks - - repo: https://github.com/ikamensh/flynt - rev: "1.0.6" - hooks: - - id: flynt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.15.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/cursorless-talon-dev/src/default_vocabulary.py b/cursorless-talon-dev/src/default_vocabulary.py index 62445cd38e..79219c8a16 100644 --- a/cursorless-talon-dev/src/default_vocabulary.py +++ b/cursorless-talon-dev/src/default_vocabulary.py @@ -12,10 +12,48 @@ """ # https://github.com/talonhub/community/blob/9acb6c9659bb0c9b794a7b7126d025603b4ed726/core/keys/keys.py#L10 -initial_default_alphabet = "air bat cap drum each fine gust harp sit jury crunch look made near odd pit quench red sun trap urge vest whale plex yank zip".split() +initial_default_alphabet = [ + "air", + "bat", + "cap", + "drum", + "each", + "fine", + "gust", + "harp", + "sit", + "jury", + "crunch", + "look", + "made", + "near", + "odd", + "pit", + "quench", + "red", + "sun", + "trap", + "urge", + "vest", + "whale", + "plex", + "yank", + "zip", +] # https://github.com/talonhub/community/blob/9acb6c9659bb0c9b794a7b7126d025603b4ed726/core/keys/keys.py#L24 -digits = "zero one two three four five six seven eight nine".split() +digits = [ + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", +] # https://github.com/talonhub/community/blob/9acb6c9659bb0c9b794a7b7126d025603b4ed726/core/keys/keys.py#L139C1-L171C2 punctuation_words = { diff --git a/cursorless-talon/src/cheatsheet/sections/destinations.py b/cursorless-talon/src/cheatsheet/sections/destinations.py index 6c08e3b41a..2c5fd1a832 100644 --- a/cursorless-talon/src/cheatsheet/sections/destinations.py +++ b/cursorless-talon/src/cheatsheet/sections/destinations.py @@ -3,7 +3,7 @@ def get_destinations() -> list[ListItemDescriptor]: insertion_modes = { - **{p: "to" for p in get_raw_list("insertion_mode_to")}, + **dict.fromkeys(get_raw_list("insertion_mode_to"), "to"), **get_raw_list("insertion_mode_before_after"), } diff --git a/pyproject.toml b/pyproject.toml index f31b824fea..a2613c4c79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,8 +12,8 @@ target-version = "py311" extend-exclude = ["vendor", "data/playground/**/*.py"] [tool.ruff.lint] -select = ["E", "F", "C4", "I001", "UP", "SIM"] -ignore = ["E501", "SIM105", "UP007", "UP035"] +select = ["E", "F", "C4", "I001", "UP", "SIM", "FLY"] +ignore = ["E501", "SIM105", "UP007", "UP035", "UP045"] [tool.pyright] reportSelfClsParameterName = false