Skip to content

Commit d674b7f

Browse files
committed
build: adds linting and static type checking
1 parent f271e3f commit d674b7f

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ jobs:
2121
- run: just deps
2222
- run: just test
2323
- run: just cov
24+
- run: just lint

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,6 @@ cython_debug/
161161

162162
# Version file
163163
/src/posit/_version.py
164+
165+
# Ruff
166+
.ruff_cache/

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: local
5+
hooks:
6+
- id: format
7+
name: format
8+
entry: bash -c "just fmt"
9+
language: system
10+
- id: lint
11+
name: lint
12+
entry: bash -c "just lint"
13+
language: system

Justfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ default:
1111
#!/usr/bin/env bash
1212
{{ OPTIONS }}
1313

14-
just clean
1514
just deps
1615
just test
1716
just cov
17+
just lint
1818
just build
1919

2020
build:
@@ -23,7 +23,6 @@ build:
2323

2424
{{ PYTHON }} -m build
2525

26-
2726
cov *args="report":
2827
#!/usr/bin/env bash
2928
{{ OPTIONS }}
@@ -39,7 +38,9 @@ clean:
3938
find . -name "__pycache__" -exec rm -rf {} +
4039
rm -rf\
4140
.coverage\
41+
.mypy_cache\
4242
.pytest_cache\
43+
.ruff_cache\
4344
*.egg-info\
4445
build\
4546
dist\
@@ -51,6 +52,19 @@ deps:
5152

5253
{{ PIP }} install -e '.[test]'
5354

55+
fmt:
56+
#!/usr/bin/env bash
57+
{{ OPTIONS }}
58+
59+
{{ PYTHON }} -m ruff format .
60+
61+
lint:
62+
#!/usr/bin/env bash
63+
{{ OPTIONS }}
64+
65+
{{ PYTHON }} -m mypy --install-types --non-interactive .
66+
{{ PYTHON }} -m ruff check
67+
5468
test:
5569
#!/usr/bin/env bash
5670
{{ OPTIONS }}

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ dependencies = [
2525
[project.optional-dependencies]
2626
test = [
2727
"coverage",
28+
"mypy",
2829
"pytest",
30+
"ruff",
2931
"setuptools-scm"
3032
]
3133

src/posit/config_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_get_endpoint(self):
1919
def test_get_value_miss(self):
2020
provider = EnvironmentConfigProvider()
2121
value = provider.get_value("foobar")
22-
assert value == None
22+
assert value is None
2323

2424

2525
class TestConfigBuilder:

0 commit comments

Comments
 (0)