Skip to content

Commit

Permalink
ci: check shellscripts
Browse files Browse the repository at this point in the history
I noticed that we don't really lint our shellscripts
  • Loading branch information
Hofer-Julian committed Jan 10, 2025
1 parent 209bc8e commit f99244b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ repos:
types_or: [python, pyi]
require_serial: true
stages: [pre-commit, manual]
# Shellcheck
- id: shellcheck
name: Check shell scripts
entry: pixi run --environment=lint shellcheck
language: system
types: [shell]
stages: [pre-commit, manual]
# GitHub Actions
- id: actionlint
name: Lint GitHub Actions workflow files
Expand Down
2 changes: 2 additions & 0 deletions examples/pypi/activate.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#!/usr/bin/env bash

export MY_SUPER_ENV=hello
4 changes: 2 additions & 2 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ else
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${BINARY}.${EXTENSION}"
fi

printf "This script will automatically download and install Pixi (${VERSION}) for you.\nGetting it from this url: $DOWNLOAD_URL\n"
printf "This script will automatically download and install Pixi (%s) for you.\nGetting it from this url: %s\n" "$VERSION" "$DOWNLOAD_URL"

if ! hash curl 2> /dev/null && ! hash wget 2> /dev/null; then
echo "error: you need either 'curl' or 'wget' installed for this script."
Expand Down Expand Up @@ -125,7 +125,7 @@ update_shell() {
LINE="$2"

# shell update can be suppressed by `PIXI_NO_PATH_UPDATE` env var
[[ ! -z "${PIXI_NO_PATH_UPDATE:-}" ]] && echo "No path update because PIXI_NO_PATH_UPDATE has a value" && return
[[ -n "${PIXI_NO_PATH_UPDATE:-}" ]] && echo "No path update because PIXI_NO_PATH_UPDATE has a value" && return

# Create the file if it doesn't exist
if [ -f "$FILE" ]; then
Expand Down
1 change: 1 addition & 0 deletions src/shell_snippets/pixi-bash.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# shellcheck shell=bash
pixi() {
local first_arg="$1"
local cmd="$PIXI_EXE $*"
Expand Down
1 change: 1 addition & 0 deletions src/shell_snippets/pixi-zsh.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# shellcheck disable=all
pixi() {
local first_arg="$1"
local cmd="$PIXI_EXE $*"
Expand Down
2 changes: 1 addition & 1 deletion tests/data/channels/recipes/trampoline/print_path.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo $PATH
echo "$PATH"
2 changes: 2 additions & 0 deletions tests/scripts/test-export.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

# Run from the root of the project using `bash tests/test_export.sh`
set -e
set -x
Expand Down

0 comments on commit f99244b

Please sign in to comment.