Skip to content

Commit d5aae6b

Browse files
committed
Update Ruff and Unit Tests
1 parent 8f1d7c1 commit d5aae6b

File tree

10 files changed

+74
-140
lines changed

10 files changed

+74
-140
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
*
22

33
!.github/
4-
!.github/**/
4+
!.github/**
55
!assets/
6-
!assets/**/
6+
!assets/**
77
!.editorconfig
8+
!.envrc
89
!.gitattributes
910
!.gitignore
1011
!.gitkeep
@@ -16,13 +17,13 @@
1617
!README.md
1718

1819
!scripts/
19-
!scripts/**/
20+
!scripts/**
2021
!shared/
21-
!shared/**/
22+
!shared/**
2223
!src/
23-
!src/**/
24+
!src/**
2425
!tests/
25-
!tests/**/
26+
!tests/**
2627

2728
!*.md
2829
!*.mdc

.pre-commit-config.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,39 @@ repos:
44
hooks:
55
# Basic safety checks
66
- id: check-added-large-files
7-
- id: check-merge-conflict
7+
- id: check-ast
8+
- id: check-builtin-literals
89
- id: check-case-conflict
9-
- id: check-symlinks
10-
- id: destroyed-symlinks
10+
- id: check-docstring-first
1111
- id: check-executables-have-shebangs
12-
- id: check-shebang-scripts-are-executable
12+
- id: check-json
13+
- id: check-merge-conflict
14+
- id: check-symlinks
1315
- id: check-toml
16+
- id: check-vcs-permalinks
17+
- id: check-xml
1418
- id: check-yaml
19+
args: ["--allow-multiple-documents"]
20+
- id: destroyed-symlinks
21+
- id: check-shebang-scripts-are-executable
1522

1623
# Simple auto-fixers
1724
- id: end-of-file-fixer
25+
- id: fix-byte-order-marker
26+
- id: mixed-line-ending
27+
- id: pretty-format-json
28+
args: ["--autofix"]
29+
- id: requirements-txt-fixer
30+
- id: sort-simple-yaml
1831
- id: trailing-whitespace
1932

2033
# Quick correctness checks
2134
- id: debug-statements
35+
- id: name-tests-test
2236

2337
# Security checks (can also be placed last)
2438
- id: detect-private-key
39+
- id: forbid-new-submodules
2540

2641
- repo: https://github.com/PyCQA/autoflake
2742
rev: "v2.3.1"
@@ -48,4 +63,4 @@ repos:
4863
- id: ruff-format
4964
# Then linting + autofixes
5065
- id: ruff
51-
args: [--fix]
66+
args: ["--output-format=full", "--fix", "--config", "ruff.toml"]

pyproject.toml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ dev = [
2727
"pre-commit>=4.1.0",
2828
"ipykernel>=6.29.5",
2929
"pytest>=8.3.2",
30-
"deptry>=0.23.0",
31-
"mypy>=1.15.0",
3230
"pytest-cov>=6.0.0",
3331
]
3432

@@ -38,55 +36,6 @@ allow-direct-references = true
3836
[tool.hatch.build.targets.wheel]
3937
packages = ["shared", "src"]
4038

41-
[tool.mypy]
42-
exclude = "^.tmp/"
43-
ignore_missing_imports = true
44-
45-
[tool.bandit]
46-
skips = ['B101']
47-
48-
[tool.ruff]
49-
50-
extend-exclude = [
51-
"__pycache__",
52-
"docs",
53-
"site",
54-
".eggs",
55-
".git",
56-
".venv",
57-
"build",
58-
"dist",
59-
"notebooks",
60-
".cache",
61-
]
62-
line-length = 120
63-
64-
[tool.ruff.lint]
65-
ignore = [
66-
"E402", # Module level import not at top of file
67-
"E501", # Line too long
68-
"E203", # Whitespace before ':' -> conflicts with black
69-
"D401", # First line should be in imperative mood
70-
"RET504", # Unnecessary variable assignment before return statement
71-
"RET505", # Unnecessary elif after return statement
72-
"SIM102", # Use a single if-statement instead of nested if-statements
73-
"SIM117", # Merge with statements for context managers that have same scope
74-
"SIM118", # Checks for key-existence checks against dict.keys() calls
75-
]
76-
select = ["E", "F", "I"]
77-
78-
[tool.ruff.lint.per-file-ignores]
79-
"*/__init__.py" = ["F401"] # Unused import
80-
81-
[tool.ruff.lint.isort]
82-
known-first-party = ["modern_python", "core"]
83-
84-
[tool.ruff.lint.pydocstyle]
85-
convention = "google"
86-
87-
[tool.ruff.lint.mccabe]
88-
max-complexity = 30
89-
9039
[tool.pytest.ini_options]
9140
cache_dir = ".pytest_cache"
9241
pythonpath = [".", "scripts", "src"]

ruff.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
extend-exclude = [
2+
"__pycache__",
3+
"docs",
4+
"site",
5+
".eggs",
6+
".git",
7+
".venv",
8+
"build",
9+
"dist",
10+
"notebooks",
11+
".cache",
12+
]
13+
line-length = 120
14+
15+
[lint]
16+
extend-select = [
17+
# Ruff-specific rules
18+
"RUF",
19+
]
20+
ignore = [
21+
"E402", # Module level import not at top of file
22+
"E501", # Line too long
23+
"E203", # Whitespace before ':' -> conflicts with black
24+
"D401", # First line should be in imperative mood
25+
"RET504", # Unnecessary variable assignment before return statement
26+
"RET505", # Unnecessary elif after return statement
27+
"SIM102", # Use a single if-statement instead of nested if-statements
28+
"SIM117", # Merge with statements for context managers that have same scope
29+
"SIM118", # Checks for key-existence checks against dict.keys() calls
30+
]
31+
select = ["E", "F", "I"]
32+
33+
[lint.per-file-ignores]
34+
"*/__init__.py" = ["F401"] # Unused import
35+
36+
[lint.isort]
37+
known-first-party = ["modern_python", "core"]
38+
39+
40+
[lint.pydocstyle]
41+
convention = "google"
42+
43+
[lint.mccabe]
44+
max-complexity = 30

tests/conftest.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from this import return_one # type: ignore
22

33

4-
def test_this():
4+
def return_one_test():
55
assert return_one() == 1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from utils import get_token
22

33

4-
def test_get_token(monkeypatch):
4+
def get_token_test(monkeypatch):
55
# Set up mock environment variables for the test
66
monkeypatch.setenv("TOKEN", "test_token")
77

uv.lock

Lines changed: 0 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)