Skip to content

Commit d5f8efc

Browse files
authored
fix: Improve how precommit hooks work in codespace (#92)
1 parent 658ed2c commit d5f8efc

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

.devcontainer/Dockerfile

-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ RUN touch README.md \
1010
&& mkdir -p src/python_package \
1111
&& python -m flit install --only-deps --deps develop \
1212
&& rm -r pyproject.toml README.md src
13-
14-
COPY .pre-commit-config.yaml .
15-
RUN git init . && pre-commit install-hooks

.devcontainer/devcontainer.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"ms-python.python",
1616
"ms-python.vscode-pylance",
1717
"ms-python.pylint",
18+
"ms-python.isort",
1819
"ms-python.flake8",
1920
"ms-python.black-formatter",
2021
"ms-vsliveshare.vsliveshare",
@@ -24,10 +25,6 @@
2425
],
2526
"settings": {
2627
"python.defaultInterpreterPath": "/usr/local/bin/python",
27-
"python.formatting.provider": "black",
28-
"[python]": {
29-
"editor.defaultFormatter": "ms-python.black-formatter"
30-
},
3128
"black-formatter.path": [
3229
"/usr/local/py-utils/bin/black"
3330
],
@@ -36,8 +33,12 @@
3633
],
3734
"flake8.path": [
3835
"/usr/local/py-utils/bin/flake8"
36+
],
37+
"isort.path": [
38+
"/usr/local/py-utils/bin/isort"
3939
]
4040
}
4141
}
42-
}
43-
}
42+
},
43+
"onCreateCommand": "pre-commit install-hooks"
44+
}

.vscode/settings.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,13 @@
1717
"pylint.args": [
1818
"--rcfile=pyproject.toml"
1919
],
20-
"pylint.path": [
21-
"/usr/local/py-utils/bin/pylint"
22-
],
2320
"black-formatter.args": [
2421
"--config=pyproject.toml"
2522
],
26-
"black-formatter.path": [
27-
"/usr/local/py-utils/bin/black"
28-
],
2923
"flake8.args": [
3024
"--toml-config=pyproject.toml"
3125
],
32-
"flake8.path": [
33-
"/usr/local/py-utils/bin/flake8"
26+
"isort.args": [
27+
"--settings-path=pyproject.toml"
3428
]
3529
}

0 commit comments

Comments
 (0)