Skip to content

Commit

Permalink
fix(templates): Ensure .vscode directory is included when requested…
Browse files Browse the repository at this point in the history
… in cookiecutters and avoid failing if it does not exist (#2183)

fix(template): Ensure `.vscode` directory is included when requested in cookiecutters and do not fail if it does not exist
  • Loading branch information
edgarrmondragon authored Jan 25, 2024
1 parent 392b1c7 commit 98d4375
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ repos:
rev: v4.5.0
hooks:
- id: check-json
exclude: |
(?x)^(
.*/launch.json
)$
- id: check-toml
exclude: |
(?x)^(
Expand Down
2 changes: 2 additions & 0 deletions cookiecutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Include template VSCode directory
!*/*/.vscode/
2 changes: 1 addition & 1 deletion cookiecutter/tap-template/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
shutil.rmtree(".github")

if "{{ cookiecutter.ide }}" != "VSCode":
shutil.rmtree(".vscode")
shutil.rmtree(".vscode", ignore_errors=True)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ repos:
rev: v4.5.0
hooks:
- id: check-json
exclude: |
(?x)^(
\.vscode/.*\.json
)$
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -20,7 +24,7 @@ repos:
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.1.14
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "{{ cookiecutter.tap_id }}",
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "{{ cookiecutter.library_name }}",
"justMyCode": false,
"args": [
"--config",
".secrets/config.json",
],
},
]
}

0 comments on commit 98d4375

Please sign in to comment.