Skip to content

Commit e80cb60

Browse files
authored
Added toml-sort tool (#1972)
* Added toml-sort to pre-commit and pyproject.toml * Runs toml-sort on pyproject.toml
1 parent c528f78 commit e80cb60

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ repos:
1212
rev: v0.1.13
1313
hooks:
1414
- id: ruff
15+
- repo: https://github.com/pappasam/toml-sort
16+
rev: v0.23.1
17+
hooks:
18+
- id: toml-sort-fix

pyproject.toml

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
[tool.mypy]
22
ignore_missing_imports = true
33
no_implicit_optional = true
4-
scripts_are_modules = true
54
plugins = [
6-
"pydantic.mypy"
5+
"pydantic.mypy",
6+
]
7+
scripts_are_modules = true
8+
9+
[tool.pytest.ini_options]
10+
# Add the specified `OPTS` to the set of command line arguments as if they had
11+
# been specified by the user.
12+
addopts = "-Werror::FutureWarning --log-cli-level=INFO -sv --durations=0"
13+
# The defined variables will be added to the environment before any tests are
14+
# run, part of pytest-env plugin
15+
env = [
16+
"DISABLE_SYMLINKS_IN_WINDOWS_TESTS=1",
17+
"HF_TOKEN=",
18+
"HUGGINGFACE_CO_STAGING=1",
19+
"HUGGING_FACE_HUB_TOKEN=",
720
]
821

922
[tool.ruff]
10-
# Ignored rules:
11-
# "E501" -> line length violation
12-
ignore = ["E501"]
13-
select = ["E", "F", "I", "W"]
14-
line-length = 119
1523
exclude = [
1624
".eggs",
1725
".git",
@@ -32,20 +40,19 @@ exclude = [
3240
"dist",
3341
"venv",
3442
]
43+
# Ignored rules:
44+
# "E501" -> line length violation
45+
ignore = ["E501"]
46+
line-length = 119
47+
select = ["E", "F", "I", "W"]
3548

3649
[tool.ruff.lint.isort]
37-
lines-after-imports = 2
3850
known-first-party = ["huggingface_hub"]
51+
lines-after-imports = 2
3952

40-
[tool.pytest.ini_options]
41-
# Add the specified `OPTS` to the set of command line arguments as if they had
42-
# been specified by the user.
43-
addopts = "-Werror::FutureWarning --log-cli-level=INFO -sv --durations=0"
44-
# The defined variables will be added to the environment before any tests are
45-
# run, part of pytest-env plugin
46-
env = [
47-
"HF_TOKEN=",
48-
"HUGGING_FACE_HUB_TOKEN=",
49-
"HUGGINGFACE_CO_STAGING=1",
50-
"DISABLE_SYMLINKS_IN_WINDOWS_TESTS=1",
51-
]
53+
[tool.tomlsort]
54+
all = true
55+
in_place = true
56+
spaces_before_inline_comment = 2 # Match Python PEP 8
57+
spaces_indent_inline_array = 4 # Match Python PEP 8
58+
trailing_comma_inline_array = true

0 commit comments

Comments
 (0)