mirror of
https://github.com/ironfox-oss/IronFox.git
synced 2026-09-17 08:52:34 -04:00
ironfox-oss/IronFox!162 Add a blocking `lint` CI stage (runs first, on a lightweight Alpine image) plus a core.hooksPath pre-commit hook, with scripts/lint.sh as the shared runner for CI, the hook, and manual use. Checks are configured in .shellcheckrc and formatting in .editorconfig. Reformat all scripts with shfmt (2-space indent, switch-case indent, space redirects) via .editorconfig, so a bare `shfmt` is consistent everywhere. bootstrap.sh installs shellcheck + shfmt per-OS and enables the pre-commit hook. The hook is a convenience (bypassable with --no-verify); the CI `lint-scripts` job is the enforcement gate. SC2086/SC2046 are disabled for now as tracked follow-up. MR-author: Akash Yadav <itsaky01@gmail.com> Co-authored-by: Akash Yadav <contact@itsaky.com> Approved-by: celenity <celenity@celenity.dev> Merged-by: celenity <celenity@celenity.dev>
37 lines
828 B
Bash
37 lines
828 B
Bash
# shellcheck shell=bash
|
|
# Set platform
|
|
if [[ "${OSTYPE}" == "darwin"* ]]; then
|
|
readonly IRONFOX_PLATFORM='darwin'
|
|
else
|
|
readonly IRONFOX_PLATFORM='linux'
|
|
fi
|
|
export IRONFOX_PLATFORM
|
|
|
|
# Set OS
|
|
if [[ "${IRONFOX_PLATFORM}" == 'darwin' ]]; then
|
|
readonly IRONFOX_OS='osx'
|
|
elif [[ "${IRONFOX_PLATFORM}" == 'linux' ]]; then
|
|
if [[ -f "/etc/os-release" ]]; then
|
|
source /etc/os-release
|
|
if [[ -n "${ID}" ]]; then
|
|
readonly IRONFOX_OS="${ID}"
|
|
else
|
|
readonly IRONFOX_OS='unknown'
|
|
fi
|
|
else
|
|
readonly IRONFOX_OS='unknown'
|
|
fi
|
|
else
|
|
readonly IRONFOX_OS='unknown'
|
|
fi
|
|
export IRONFOX_OS
|
|
|
|
# Set architecture
|
|
readonly PLATFORM_ARCH=$(uname -m)
|
|
if [[ "${PLATFORM_ARCH}" == 'arm64' ]]; then
|
|
readonly IRONFOX_PLATFORM_ARCH='aarch64'
|
|
else
|
|
readonly IRONFOX_PLATFORM_ARCH='x86-64'
|
|
fi
|
|
export IRONFOX_PLATFORM_ARCH
|