Skip to content

Commit 09b8e24

Browse files
committed
Standardize linting and formatting
1 parent 1709e78 commit 09b8e24

File tree

5 files changed

+246
-155
lines changed

5 files changed

+246
-155
lines changed

.pre-commit-config.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,28 @@ repos:
3131
types_or: [python, cython, rst, markdown]
3232
args: ["-L", "ACN,crate,ot,socio-economic,zar"]
3333

34+
- repo: https://github.com/shellcheck-py/shellcheck-py
35+
rev: v0.11.0.1
36+
hooks:
37+
- id: shellcheck
38+
39+
- repo: https://github.com/scop/pre-commit-shfmt
40+
rev: v3.12.0-2
41+
hooks:
42+
- id: shfmt
43+
args: ["-i", "2", "-ci", "-sr", "-w"]
44+
45+
- repo: https://github.com/adrienverge/yamllint
46+
rev: v1.37.1
47+
hooks:
48+
- id: yamllint
49+
args: [--strict]
50+
51+
- repo: https://github.com/ComPWA/taplo-pre-commit
52+
rev: v0.9.3
53+
hooks:
54+
- id: taplo-format
55+
3456
##############################################################################
3557
# Custom hooks
3658
##############################################################################
@@ -50,14 +72,14 @@ repos:
5072
# Python formatting and linting
5173
##############################################################################
5274
- repo: https://github.com/asottile/add-trailing-comma
53-
rev: v3.2.0
75+
rev: v4.0.0
5476
hooks:
5577
- id: add-trailing-comma
5678
name: add-trailing-comma
5779
types: [python]
5880

5981
- repo: https://github.com/astral-sh/ruff-pre-commit
60-
rev: v0.13.1
82+
rev: v0.14.0
6183
hooks:
6284
- id: ruff
6385
args: ["--fix"]
@@ -84,6 +106,12 @@ repos:
84106
args: ["--config", "pyproject.toml"]
85107
additional_dependencies: [types-pytz, types-redis, types-toml, types-requests, msgspec]
86108

109+
- repo: https://github.com/astral-sh/uv-pre-commit
110+
rev: 0.8.24 # Must match uv-version file
111+
hooks:
112+
- id: uv-lock
113+
files: ^python/uv\.lock$
114+
87115
- repo: https://github.com/kynan/nbstripout
88116
rev: 0.8.1
89117
hooks:

.taplo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Taplo TOML formatter configuration
2+
3+
[formatting]
4+
# Align entries (=) vertically
5+
align_entries = false
6+
7+
# Align single comments after entries
8+
align_comments = false
9+
10+
# Maximum column width before arrays are expanded
11+
column_width = 80
12+
13+
# Array formatting
14+
array_auto_expand = true # Auto expand arrays when needed
15+
array_auto_collapse = true # Collapse short arrays to single line
16+
array_trailing_comma = true # Add trailing commas to multiline arrays
17+
18+
# Compact arrays - prevents expanding short arrays
19+
compact_arrays = true
20+
21+
# Indentation
22+
indent_tables = false
23+
indent_entries = false

.yamllint.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
line-length:
6+
max: 120
7+
comments:
8+
min-spaces-from-content: 1
9+
comments-indentation: disable
10+
indentation:
11+
spaces: 2
12+
document-start: disable
13+
truthy: disable

pyproject.toml

Lines changed: 65 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
[project]
22
name = "nautilus_data"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
description = "Example data for use with NautilusTrader"
5-
authors = [
6-
{name = "Nautech Systems", email = "[email protected]"},
7-
]
5+
authors = [{ name = "Nautech Systems", email = "[email protected]" }]
86
requires-python = ">=3.13"
9-
dependencies = [
10-
"nautilus_trader>=1.220.0",
11-
"requests>=2.32.5,<3.0.0",
12-
]
7+
dependencies = ["nautilus_trader>=1.220.0", "requests>=2.32.5,<3.0.0"]
138

149
[dependency-groups]
1510
dev = [
16-
"pre-commit>=4.0.0",
17-
"pytest>=8.0.0",
18-
"ruff>=0.12.12",
19-
"mypy>=1.18.2",
20-
"zizmor>=1.13.0",
11+
"pre-commit>=4.0.0",
12+
"pytest>=8.0.0",
13+
"ruff>=0.14.0",
14+
"mypy>=1.18.2",
15+
"zizmor>=1.14.2",
2116
]
2217

2318
[build-system]
@@ -52,70 +47,70 @@ target-version = "py313"
5247
line-length = 100
5348

5449
exclude = [
55-
".benchmarks",
56-
".eggs",
57-
".git",
58-
".mypy_cache",
59-
".pytest_cache",
60-
".ruff_cache",
61-
".venv",
62-
"dist",
63-
"venv",
50+
".benchmarks",
51+
".eggs",
52+
".git",
53+
".mypy_cache",
54+
".pytest_cache",
55+
".ruff_cache",
56+
".venv",
57+
"dist",
58+
"venv",
6459
]
6560

6661
[tool.ruff.lint]
6762
select = [
68-
"C4",
69-
"E",
70-
"F",
71-
"W",
72-
"C90",
73-
"D",
74-
# "DTZ",
75-
"UP",
76-
"S",
77-
"T10",
78-
"ICN",
79-
"PIE",
80-
# "PT",
81-
"PYI",
82-
"Q",
83-
"I",
84-
"RSE",
85-
"TID",
86-
# "SIM",
87-
# "ARG",
88-
# "ERA",
89-
"PD",
90-
# "PGH",
91-
# "PLW",
92-
"NPY",
93-
"RUF",
63+
"C4",
64+
"E",
65+
"F",
66+
"W",
67+
"C90",
68+
"D",
69+
# "DTZ",
70+
"UP",
71+
"S",
72+
"T10",
73+
"ICN",
74+
"PIE",
75+
# "PT",
76+
"PYI",
77+
"Q",
78+
"I",
79+
"RSE",
80+
"TID",
81+
# "SIM",
82+
# "ARG",
83+
# "ERA",
84+
"PD",
85+
# "PGH",
86+
# "PLW",
87+
"NPY",
88+
"RUF",
9489
]
9590

9691
ignore = [
97-
"D100", # Missing docstring in public module **fix**
98-
"D101",
99-
"D102", # Missing docstring in public method **fix**
100-
"D103", # Missing docstring in public function **fix**
101-
"D104", # Missing docstring in public package **fix**
102-
"D107",
103-
"D105",
104-
"D200", # One-line docstring should fit on one line with quotes (optional style)
105-
"D203", # 1 blank line required before class docstring (optional style)
106-
"D205", # 1 blank line required between summary line and description (optional style)
107-
"D212", # Multi-line docstring summary should start at the first line (optional style)
108-
"D400", # First line should end with a period (not always a first line)
109-
"D413", # Missing blank line after last section ('Parameters')
110-
"D415", # First line should end with a period, question mark, or exclamation point (not always a first line)
111-
"D416", # Section name should end with a colon ('Warnings:', not 'Warnings') (incorrect?)
112-
"E741", # Ambiguous variable name (single char)
113-
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
114-
"S101", # Use of assert detected (OK in test suite)
115-
"S105", # Use of hard-coded password (spurious)
116-
"S106", # Use of hard-coded password (spurious)
117-
"S113", # Probable use of requests call without timeout **fix**
118-
"S603", # `subprocess` call: check for execution of untrusted input **fix**
92+
"D100", # Missing docstring in public module **fix**
93+
"D101",
94+
"D102", # Missing docstring in public method **fix**
95+
"D103", # Missing docstring in public function **fix**
96+
"D104", # Missing docstring in public package **fix**
97+
"D107",
98+
"D105",
99+
"D200", # One-line docstring should fit on one line with quotes (optional style)
100+
"D203", # 1 blank line required before class docstring (optional style)
101+
"D205", # 1 blank line required between summary line and description (optional style)
102+
"D212", # Multi-line docstring summary should start at the first line (optional style)
103+
"D400", # First line should end with a period (not always a first line)
104+
"D413", # Missing blank line after last section ('Parameters')
105+
"D415", # First line should end with a period, question mark, or exclamation point (not always a first line)
106+
"D416", # Section name should end with a colon ('Warnings:', not 'Warnings') (incorrect?)
107+
"E741", # Ambiguous variable name (single char)
108+
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
109+
"S101", # Use of assert detected (OK in test suite)
110+
"S105", # Use of hard-coded password (spurious)
111+
"S106", # Use of hard-coded password (spurious)
112+
"S113", # Probable use of requests call without timeout **fix**
113+
"S603", # `subprocess` call: check for execution of untrusted input **fix**
119114
]
120115

121116
# Allow autofix for all enabled rules (when `--fix`) is provided

0 commit comments

Comments
 (0)