Skip to content

Commit

Permalink
Switch from black to ruff (#2306)
Browse files Browse the repository at this point in the history
See https://docs.astral.sh/ruff/formatter/

## Checklist

- [x] I have run Talon spoken form tests
- [-] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [-] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [x] I have not broken the cheatsheet
  • Loading branch information
pokey authored Apr 26, 2024
1 parent a1bb6e4 commit 4fa46de
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ repos:
hooks:
- id: flynt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.4.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
hooks:
- id: black
- id: ruff-format
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Place your settings in this file to overwrite default and user settings.
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[scm]": {
"editor.defaultFormatter": "AndreasArvidsson.andreas-talon"
Expand Down
2 changes: 1 addition & 1 deletion cursorless-talon/src/marks/decorated_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def cursorless_grapheme(m) -> str:
except AttributeError:
# NB: This represents unknown char in Unicode. It will be translated
# to "[unk]" by Cursorless extension.
return "\uFFFD"
return "\ufffd"


@mod.capture(
Expand Down
2 changes: 1 addition & 1 deletion cursorless-talon/src/private_api/private_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def cursorless_private_build_primitive_target(
return PrimitiveTarget(mark, modifiers)

def cursorless_private_build_list_target(
elements: list[Union[PrimitiveTarget, RangeTarget]]
elements: list[Union[PrimitiveTarget, RangeTarget]],
) -> Union[PrimitiveTarget, ListTarget]:
"""Cursorless private api low-level target builder: Create a list target"""
if len(elements) == 1:
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ force-exclude = '''
'''

[tool.ruff]
select = ["E", "F", "C4", "I001", "UP", "SIM"]
ignore = ["E501", "SIM105", "UP007", "UP035"]
target-version = "py311"
extend-exclude = ["vendor", "data/playground/**/*.py"]

[tool.ruff.lint]
select = ["E", "F", "C4", "I001", "UP", "SIM"]
ignore = ["E501", "SIM105", "UP007", "UP035"]

[tool.pyright]
reportSelfClsParameterName = false

0 comments on commit 4fa46de

Please sign in to comment.