Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPO: Add devcontainer configuraiton #465

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "allStarLink Dev",
"image": "mcr.microsoft.com/devcontainers/cpp:dev-debian12",
"postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"postStartCommand": "git config --global core.hooksPath ${containerWorkspaceFolder}/dev/",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "codespell,clang-format"
}
},
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"ms-vscode.cpptools-extension-pack",
"GitHub.vscode-pull-request-github"
],
"settings": {
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh"
}
}
}
}
42 changes: 42 additions & 0 deletions dev/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi

# Test clang-format
clangformatout=$(git clang-format --style=file:./dev/.clang-format --diff --staged -q)

# Redirect output to stderr.
exec 1>&2

if [ "$clangformatout" != "" ]
then
echo "Format error!"
echo "Use git clang-format"
exit 1
fi

codespell=$(codespell --skip="./.git" --ignore-words=./dev/.codespellignore)

exec 1>&2

if [ "$codespell" != "" ]
then
echo "Spelling errors!"
echo "Run codespell"
echo $codespell
exit 1
fi