Skip to content

Commit 4bbc492

Browse files
authored
Merge pull request #64 from IBM/update-shell-scripts-lint
Add linters for shell, and add improved run-gunicorn-v2.sh
2 parents 3e2d395 + 0ccc203 commit 4bbc492

File tree

4 files changed

+419
-4
lines changed

4 files changed

+419
-4
lines changed

.github/.renovate.json5

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
/*
3+
* https://docs.renovatebot.com/configuration-options/
4+
* 1️⃣ General bot behaviour
5+
* ──────────────────────────
6+
*/
7+
"extends": [
8+
"config:base", /* sensible defaults, but no major-bumps or grouping magic */
9+
":weekly" /* run once a week, early Monday UTC (≈ Sun night US / Mon AM EU) */
10+
],
11+
12+
/* Only open one brand-new branch or PR during the weekly window */
13+
"prHourlyLimit": 1,
14+
15+
/*
16+
* 2️⃣ Package-specific safeguards
17+
* ───────────────────────────────
18+
* We simply turn *off* major-update PRs for the three troublesome deps.
19+
* Minor / patch releases (incl. security fixes) still flow through.
20+
*/
21+
"packageRules": [
22+
{
23+
"description": "🚫 Never bump the project Python major",
24+
"matchPackageNames": ["python"],
25+
"matchUpdateTypes": ["major"],
26+
"enabled": false
27+
},
28+
{
29+
"description": "🚫 Stay on CodeMirror 5.x",
30+
"matchPackageNames": ["codemirror"],
31+
"matchUpdateTypes": ["major"],
32+
"enabled": false
33+
},
34+
{
35+
"description": "🚫 Stay on Tailwind 2.x",
36+
"matchPackageNames": ["tailwindcss"],
37+
"matchUpdateTypes": ["major"],
38+
"enabled": false
39+
}
40+
],
41+
42+
/*
43+
* 3️⃣ Quality-of-life niceties (optional, but handy)
44+
* ──────────────────────────────────────────────────
45+
*/
46+
"dependencyDashboard": true, /* one place to see/snooze every update */
47+
"prCreation": "not-pending", /* PR appears only after CI finishes the branch */
48+
"rebaseWhen": "behind-base-branch" /* keep approved PRs fresh until you hit "merge" */
49+
}

Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,3 +1835,66 @@ devpi-delete: devpi-setup-user ## Delete mcpgateway==$(VER) from
18351835
devpi use $(DEVPI_INDEX) && \
18361836
devpi remove -y mcpgateway==$(VER) || true"
18371837
@echo "✅ Delete complete (if it existed)"
1838+
1839+
1840+
# =============================================================================
1841+
# 🐚 LINT SHELL FILES
1842+
# =============================================================================
1843+
# help: 🐚 LINT SHELL FILES
1844+
# help: shell-linters-install - Install ShellCheck, shfmt & bashate (best-effort per OS)
1845+
# help: shell-lint - Run shfmt (check-only) + ShellCheck + bashate on every *.sh
1846+
# help: shfmt-fix - AUTO-FORMAT all *.sh in-place with shfmt -w
1847+
# -----------------------------------------------------------------------------
1848+
1849+
# ──────────────────────────
1850+
# Which shell files to scan
1851+
# ──────────────────────────
1852+
SHELL_SCRIPTS := $(shell find . -type f -name '*.sh' -not -path './node_modules/*')
1853+
1854+
.PHONY: shell-linters-install shell-lint shfmt-fix shellcheck bashate
1855+
1856+
shell-linters-install: ## 🔧 Install shellcheck, shfmt, bashate
1857+
@echo "🔧 Installing/ensuring shell linters are present…"
1858+
@set -e ; \
1859+
# -------- ShellCheck -------- \
1860+
if ! command -v shellcheck >/dev/null 2>&1 ; then \
1861+
echo "🛠 Installing ShellCheck…" ; \
1862+
case "$$(uname -s)" in \
1863+
Darwin) brew install shellcheck ;; \
1864+
Linux) { command -v apt-get && sudo apt-get update -qq && sudo apt-get install -y shellcheck ; } || \
1865+
{ command -v dnf && sudo dnf install -y ShellCheck ; } || \
1866+
{ command -v pacman && sudo pacman -Sy --noconfirm shellcheck ; } || true ;; \
1867+
*) echo "⚠️ Please install ShellCheck manually" ;; \
1868+
esac ; \
1869+
fi ; \
1870+
# -------- shfmt (Go) -------- \
1871+
if ! command -v shfmt >/dev/null 2>&1 ; then \
1872+
echo "🛠 Installing shfmt…" ; \
1873+
GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest || \
1874+
{ echo "⚠️ go not found – install Go or brew/apt shfmt package manually"; } ; \
1875+
export PATH=$$PATH:$$HOME/go/bin ; \
1876+
fi ; \
1877+
# -------- bashate (pip) ----- \
1878+
if ! $(VENV_DIR)/bin/bashate -h >/dev/null 2>&1 ; then \
1879+
echo "🛠 Installing bashate (into venv)…" ; \
1880+
test -d "$(VENV_DIR)" || $(MAKE) venv ; \
1881+
/bin/bash -c "source $(VENV_DIR)/bin/activate && python -m pip install --quiet bashate" ; \
1882+
fi
1883+
@echo "✅ Shell linters ready."
1884+
1885+
# -----------------------------------------------------------------------------
1886+
1887+
shell-lint: shell-linters-install ## 🔍 Run shfmt, ShellCheck & bashate
1888+
@echo "🔍 Running shfmt (diff-only)…"
1889+
@shfmt -d -i 4 -ci $(SHELL_SCRIPTS) || true
1890+
@echo "🔍 Running ShellCheck…"
1891+
@shellcheck $(SHELL_SCRIPTS) || true
1892+
@echo "🔍 Running bashate…"
1893+
@$(VENV_DIR)/bin/bashate -C $(SHELL_SCRIPTS) || true
1894+
@echo "✅ Shell lint complete."
1895+
1896+
1897+
shfmt-fix: shell-linters-install ## 🎨 Auto-format *.sh in place
1898+
@echo "🎨 Formatting shell scripts with shfmt -w…"
1899+
@shfmt -w -i 4 -ci $(SHELL_SCRIPTS)
1900+
@echo "✅ shfmt formatting done."

0 commit comments

Comments
 (0)