Skip to content

Commit b1f3b99

Browse files
authored
Merge pull request #144 from blooop/feature/shellcheck
Feature/shellcheck
2 parents 5d86fe8 + e6af7f3 commit b1f3b99

8 files changed

Lines changed: 26 additions & 10 deletions

File tree

.claude/hooks/SessionStart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SessionStart hook for Claude Code online environment
33
# This script sets up the Python development environment using pixi
44

5-
set -e
5+
set -eo pipefail
66

77
echo "🚀 Setting up Python Template environment..."
88

@@ -15,6 +15,7 @@ if ! command -v pixi &> /dev/null; then
1515
export PATH="$HOME/.pixi/bin:$PATH"
1616

1717
# Source bashrc to get pixi in PATH (if bashrc was updated)
18+
# shellcheck disable=SC1091
1819
[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
1920

2021
echo "✅ Pixi installed successfully"

.devcontainer/claude-code/install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/bin/sh
2-
set -eu
1+
#!/bin/bash
2+
set -euo pipefail
33

44
# Claude Code CLI Local Feature Install Script
55
# Installs Claude Code via pixi and sets up configuration directories
@@ -83,6 +83,7 @@ install_claude_code() {
8383

8484
# Add pixi bin path to user's profile if not already there
8585
local profile="$TARGET_HOME/.profile"
86+
# shellcheck disable=SC2016
8687
local pixi_path_line='export PATH="$HOME/.pixi/bin:$PATH"'
8788
if [ -f "$profile" ] && ! grep -q '\.pixi/bin' "$profile"; then
8889
echo "$pixi_path_line" >> "$profile"
@@ -93,6 +94,7 @@ install_claude_code() {
9394

9495
# Workaround: pixi trampoline fails for bash scripts, so add env bin directly
9596
# This conditionally adds the path only if the env exists
97+
# shellcheck disable=SC2016
9698
local env_path_line='[ -d "$HOME/.pixi/envs/claude-shim/bin" ] && export PATH="$HOME/.pixi/envs/claude-shim/bin:$PATH"'
9799
if [ -f "$profile" ] && ! grep -q 'pixi/envs/claude-shim' "$profile"; then
98100
echo "# Workaround: pixi trampoline fails for bash scripts" >> "$profile"

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
"features": {
1414
"./claude-code": {},
15-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
16-
"ghcr.io/devcontainers/features/common-utils:2": {}
15+
// "ghcr.io/devcontainers/features/docker-in-docker:2": {},
16+
// "ghcr.io/devcontainers/features/common-utils:2": {}
1717
},
1818

1919
"initializeCommand": ".devcontainer/claude-code/init-host.sh",

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ repos:
4848
# Run the formatter.
4949
- id: ruff-format
5050
types_or: [ python, pyi ]
51+
# Shell script linter
52+
- repo: https://github.com/koalaman/shellcheck-precommit
53+
rev: v0.11.0
54+
hooks:
55+
- id: shellcheck
56+
5157
# Checks for spelling mistakes
5258
- repo: https://github.com/codespell-project/codespell
5359
rev: v2.3.0

scripts/launch_vscode.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/bash
2-
set -e
2+
set -eo pipefail
33

44
export COMPOSE_DOCKER_CLI_BUILD=1
55
export DOCKER_BUILDKIT=1
@@ -25,14 +25,16 @@ if [ ! -d "$VENV_DIR" ]; then
2525
echo "Creating virtual environment in $VENV_DIR..."
2626
python3 -m venv "$VENV_DIR"
2727
echo "Activating the virtual environment..."
28-
source $VENV_DIR/bin/activate
28+
# shellcheck disable=SC1091
29+
source "$VENV_DIR/bin/activate"
2930
echo "Installing deps rocker..."
3031
pip install deps-rocker pixi-rocker rockervsc
3132
echo "Virtual environment setup and deps rocker installation complete."
3233
else
3334
echo "Virtual environment already exists in $VENV_DIR."
3435
echo "Activating the existing virtual environment..."
35-
source $VENV_DIR/bin/activate
36+
# shellcheck disable=SC1091
37+
source "$VENV_DIR/bin/activate"
3638
fi
3739

3840
rockervsc

scripts/rename_project.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
set -eo pipefail
23

34
# Escape characters special in sed replacement strings (\, &, /)
45
escape_sed() { printf '%s\n' "$1" | sed 's/[\\&/]/\\&/g'; }

scripts/setup_host.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#! /bin/bash
2+
set -eo pipefail
23

34
#Sets up docker, nvidia docker git-lfs and rocker which are used to clone and setup docker containers
45

56
#COPIED FROM OFFICIAL DOCKER INSTALL INSTRUCTIONS
67
# https://docs.docker.com/engine/install/ubuntu/
78

89
#remove incorrect docker
9-
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
10+
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove "$pkg"; done
1011

1112
# Add Docker's official GPG key:
1213
sudo apt update
@@ -16,6 +17,7 @@ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyring
1617
sudo chmod a+r /etc/apt/keyrings/docker.asc
1718

1819
# Add the repository to Apt sources:
20+
# shellcheck disable=SC1091
1921
echo \
2022
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
2123
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
@@ -52,11 +54,12 @@ echo "you may need to restart your machine"
5254

5355
#INSTALL PIXI
5456
curl -fsSL https://pixi.sh/install.sh | bash
57+
# shellcheck disable=SC2016
5558
echo 'eval "$(pixi completion --shell bash)"' >> ~/.bashrc
5659

5760
#INSTALL UV
5861
curl -LsSf https://astral.sh/uv/install.sh | sh
5962

6063
sudo groupadd docker
61-
sudo usermod -aG docker $USER
64+
sudo usermod -aG docker "$USER"
6265
newgrp docker || true

scripts/update_from_template.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! /bin/bash
2+
set -eo pipefail
23

34
git config --global pull.rebase false
45
git remote add template https://github.com/blooop/python_template.git

0 commit comments

Comments
 (0)