Skip to content

Commit 7990ab8

Browse files
committed
Use the new hatch fmt command to run linters and formatting
Right now this defaults to a pretty old version of ruff. Hatch pins a ruff version though, so I'm inclined to just use whatever ruff version Hatch uses. Signed-off-by: Nic Cope <[email protected]>
1 parent d10f084 commit 7990ab8

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: pipx install hatch==${{ env.HATCH_VERSION }}
5050

5151
- name: Lint
52-
run: hatch run lint:check
52+
run: hatch fmt
5353

5454
unit-test:
5555
runs-on: ubuntu-22.04

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Some useful commands:
3434
# Generate gRPC stubs.
3535
hatch run generate:protoc
3636

37-
# Lint the code.
38-
hatch run lint:check
37+
# Format and lint the code.
38+
hatch fmt
3939

4040
# Run unit tests.
4141
hatch test

pyproject.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@ dependencies = ["grpcio-tools==1.66.2"]
4949
[tool.hatch.envs.generate.scripts]
5050
protoc = "python -m grpc_tools.protoc --proto_path=. --python_out=. --pyi_out=. --grpc_python_out=. crossplane/function/proto/v1beta1/run_function.proto crossplane/function/proto/v1/run_function.proto"
5151

52-
[tool.hatch.envs.lint]
53-
type = "virtual"
54-
detached = true
55-
path = ".venv-lint"
56-
dependencies = ["ruff==0.6.9"]
57-
58-
[tool.hatch.envs.lint.scripts]
59-
check = "ruff format crossplane tests && ruff check --fix crossplane tests"
60-
6152
[tool.hatch.envs.docs]
6253
type = "virtual"
6354
path = ".venv-docs"
@@ -69,6 +60,11 @@ generate = "pdoc -m google crossplane/function -o docs"
6960
[tool.hatch.build.targets.wheel]
7061
packages = ["crossplane"]
7162

63+
# This special environment is used by hatch fmt.
64+
[tool.hatch.envs.hatch-static-analysis]
65+
dependencies = ["ruff==0.6.9"]
66+
config-path = "none" # Disable Hatch's default Ruff config.
67+
7268
[tool.ruff]
7369
target-version = "py311"
7470
exclude = ["crossplane/function/proto/*", "tests/testdata/*"]

0 commit comments

Comments
 (0)