Skip to content

Commit

Permalink
maint: use ruff instead of black (#776)
Browse files Browse the repository at this point in the history
* maint: use ruff in pre-commit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
agoose77 and pre-commit-ci[bot] authored Nov 9, 2023
1 parent 615fa53 commit 7fce629
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
13 changes: 5 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: flake8

- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
Expand Down
6 changes: 1 addition & 5 deletions src/sphinx_book_theme/_compile_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ def convert_json(folder=None):
if language in RENAME_LANGUAGE_CODES:
language = RENAME_LANGUAGE_CODES[language]
out_path = (
out_folder
/ "locales"
/ language
/ "LC_MESSAGES"
/ "booktheme.po" # noqa: E501
out_folder / "locales" / language / "LC_MESSAGES" / "booktheme.po" # noqa: E501
)
if not out_path.parent.exists():
out_path.parent.mkdir(parents=True)
Expand Down
12 changes: 3 additions & 9 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ def test_build_book(sphinx_build_factory, file_regression):
def test_navbar_options_home_page_in_toc(sphinx_build_factory):
sphinx_build = sphinx_build_factory(
"base", confoverrides={"html_theme_options.home_page_in_toc": True}
).build(
assert_pass=True
) # type: SphinxBuild
).build(assert_pass=True) # type: SphinxBuild
navbar = sphinx_build.html_tree("index.html").find(
"nav", attrs={"class": "bd-docs-nav"}
)
Expand All @@ -169,9 +167,7 @@ def test_navbar_options_home_page_in_toc(sphinx_build_factory):
def test_navbar_options(sphinx_build_factory, option, value):
sphinx_build = sphinx_build_factory(
"base", confoverrides={f"html_theme_options.{option}": value}
).build(
assert_pass=True
) # type: SphinxBuild
).build(assert_pass=True) # type: SphinxBuild
assert value in str(sphinx_build.html_tree("section1", "ntbk.html"))


Expand Down Expand Up @@ -407,9 +403,7 @@ def test_show_navbar_depth(sphinx_build_factory):
"navigation_with_keys": True,
}
},
).build(
assert_pass=True
) # type: SphinxBuild
).build(assert_pass=True) # type: SphinxBuild
sidebar = sphinx_build.html_tree("section1", "ntbk.html").find_all(
attrs={"class": "bd-sidebar"}
)[0]
Expand Down

0 comments on commit 7fce629

Please sign in to comment.