-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Labels
choreLinting, formatting, dependency hygiene, or project maintenance choresLinting, formatting, dependency hygiene, or project maintenance chorescicdIssue with CI/CD process (GitHub Actions, scaffolding)Issue with CI/CD process (GitHub Actions, scaffolding)devopsDevOps activities (containers, automation, deployment, makefiles, etc)DevOps activities (containers, automation, deployment, makefiles, etc)triageIssues / Features awaiting triageIssues / Features awaiting triage
Milestone
Description
🔧 Chore Description
Description:
Several Makefile targets fail because they either check for system commands that don't exist, call tools directly without proper venv handling, or expect system utilities to be pre-installed. These need to be fixed to either use venv properly or handle missing system dependencies gracefully.
This means you no longer need to activate your venv before running all Makefile targets.
📋 Actual Broken Targets
After re-evaluation, here are the targets that actually need fixing:
Targets with Incorrect Command Checks
-
tomllint
- Checks for systemtomlcheck
withcommand -v
then fails, should install in venv first -
yamllint
- Checks for systemyamllint
withcommand -v
then fails, should install in venv first -
jsonlint
- Expects systemjq
to be installed, no venv option
Targets Calling Tools Directly (No Venv)
-
wily
- Callswily
directly without$(VENV_DIR)/bin/
-
depend
- Callspdm
directly -
snakeviz
- Callspython3
andsnakeviz
directly -
pstats
- Callspython3
andgprof2dot
directly -
docs
- Callsuv handsdown
directly -
images
- Callscode2flow
,dot
,pyreverse
directly (mix of venv and system tools)
System Tools That Need Better Error Handling
-
scc
/scc-report
- Calls systemscc
directly -
grype-scan
/grype-sarif
- Calls systemgrype
directly -
trivy
- Calls systemtrivy
directly -
dockle
- Calls systemdockle
directly -
hadolint
- Calls systemhadolint
directly -
osv-scan-source
/osv-scan-image
- Calls systemosv-scanner
directly -
shell-lint
- Calls systemshfmt
andshellcheck
directly
🔧 Fix Examples
1. Fix tomllint (venv-based tool):
Current (broken):
tomllint:
@command -v tomlcheck >/dev/null 2>&1 || { \
echo '❌ tomlcheck not installed ➜ pip install tomlcheck'; exit 1; }
@echo '📑 tomllint (tomlcheck) ...'
@find . -type f -name '*.toml' -print0 \
| xargs -0 -I{} $(VENV_DIR)/bin/tomlcheck "{}"
Fixed:
tomllint:
@echo '📑 tomllint (tomlcheck) ...'
@test -d "$(VENV_DIR)" || $(MAKE) venv
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip install -q tomlcheck 2>/dev/null || true"
@find . -type f -name '*.toml' -print0 \
| xargs -0 -I{} $(VENV_DIR)/bin/tomlcheck "{}"
2. Fix yamllint (venv-based tool):
Fixed:
yamllint:
@echo '📑 yamllint ...'
@test -d "$(VENV_DIR)" || $(MAKE) venv
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip install -q yamllint 2>/dev/null || true"
@$(VENV_DIR)/bin/yamllint -c .yamllint .
3. Fix wily:
Fixed:
wily:
@echo "📈 Maintainability report..."
@test -d "$(VENV_DIR)" || $(MAKE) venv
@git stash --quiet
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip install -q wily && \
python3 -m wily build -n 10 . > /dev/null || true && \
python3 -m wily report . || true"
@git stash pop --quiet
4. Fix depend:
Fixed:
depend:
@test -d "$(VENV_DIR)" || $(MAKE) venv
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip install -q pdm && \
pdm list --freeze"
5. Fix system tools with better error messages:
Fixed trivy:
trivy:
@command -v trivy >/dev/null 2>&1 || { \
echo "❌ trivy not installed."; \
echo "💡 Install with:"; \
echo " • macOS: brew install trivy"; \
echo " • Linux: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin"; \
echo " • Or run: make trivy-install"; \
exit 1; \
}
@systemctl --user enable --now podman.socket 2>/dev/null || true
@echo "🔎 trivy vulnerability scan..."
@trivy --format table --severity HIGH,CRITICAL image $(IMG)
6. Fix docs target:
Fixed:
docs: images sbom
@echo "📚 Generating documentation with handsdown..."
@test -d "$(VENV_DIR)" || $(MAKE) venv
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip install -q handsdown && \
python3 -m handsdown --external https://github.com/yourorg/$(PROJECT_NAME)/ \
-o $(DOCS_DIR)/docs \
-n app --name '$(PROJECT_NAME)' --cleanup"
# ... rest of the target
7. Fix snakeviz:
Fixed:
snakeviz:
@echo "🐍 Interactive profile visualiser..."
@test -d "$(VENV_DIR)" || $(MAKE) venv
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip install -q snakeviz && \
python3 -m cProfile -o mcp.prof mcpgateway/server.py && \
python3 -m snakeviz mcp.prof --server"
📋 Summary of Issues
- Venv-installable tools (tomllint, yamllint, wily, etc.) - Should auto-install in venv
- System tools (trivy, grype, scc, etc.) - Should provide helpful install instructions
- Direct python calls - Should use venv's python
- Missing pip installs - Some targets assume packages are pre-installed
✅ Quick Fix for All Python Tools
Add this helper function at the top of the Makefile:
# Helper to ensure a Python package is installed in venv
define ensure_pip_package
@test -d "$(VENV_DIR)" || $(MAKE) venv
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
python3 -m pip show $(1) >/dev/null 2>&1 || \
python3 -m pip install -q $(1)"
endef
Then use it like:
yamllint:
@echo '📑 yamllint ...'
$(call ensure_pip_package,yamllint)
@$(VENV_DIR)/bin/yamllint -c .yamllint .
Metadata
Metadata
Assignees
Labels
choreLinting, formatting, dependency hygiene, or project maintenance choresLinting, formatting, dependency hygiene, or project maintenance chorescicdIssue with CI/CD process (GitHub Actions, scaffolding)Issue with CI/CD process (GitHub Actions, scaffolding)devopsDevOps activities (containers, automation, deployment, makefiles, etc)DevOps activities (containers, automation, deployment, makefiles, etc)triageIssues / Features awaiting triageIssues / Features awaiting triage