Add pre-commit hooks for code quality (#19)

## Summary
- Add pre-commit framework with hooks for YAML, Ansible, Python, shell, TOML, JSON, and secret detection
- Fix all 91+ ansible-lint violations (variable naming, handler capitalization, changed_when)
- Fix shellcheck warnings in mise-tasks scripts
- Document pre-commit setup in README.md

## Deployment and Testing
- [x] All pre-commit hooks pass (`uvx pre-commit run --all-files`)
- [x] Test ansible playbook with `--check` mode
- [x] Run `mise run indri-services-check` after deploy

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: https://forge.tail8d86e.ts.net/eblume/blumeops/pulls/19
This commit is contained in:
Erich Blume 2026-01-16 19:33:02 -08:00
commit 9931829d03
57 changed files with 1013 additions and 625 deletions

View file

@ -22,15 +22,15 @@
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "red", "value": null},
{"color": "green", "value": 1}
{ "color": "red", "value": null },
{ "color": "green", "value": 1 }
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 4, "w": 4, "x": 0, "y": 0},
"gridPos": { "h": 4, "w": 4, "x": 0, "y": 0 },
"id": 1,
"options": {
"colorMode": "value",
@ -47,7 +47,7 @@
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_up",
"refId": "A"
}
@ -69,16 +69,16 @@
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null},
{"color": "yellow", "value": 100},
{"color": "red", "value": 1000}
{ "color": "green", "value": null },
{ "color": "yellow", "value": 100 },
{ "color": "red", "value": 1000 }
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 4, "w": 4, "x": 4, "y": 0},
"gridPos": { "h": 4, "w": 4, "x": 4, "y": 0 },
"id": 2,
"options": {
"colorMode": "value",
@ -95,7 +95,7 @@
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_web_whoosh_index_queue_size",
"refId": "A"
}
@ -116,15 +116,13 @@
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null}
]
"steps": [{ "color": "green", "value": null }]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 4, "w": 4, "x": 8, "y": 0},
"gridPos": { "h": 4, "w": 4, "x": 8, "y": 0 },
"id": 3,
"options": {
"colorMode": "value",
@ -141,7 +139,7 @@
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_serial",
"refId": "A"
}
@ -169,44 +167,47 @@
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {"legend": false, "tooltip": false, "viz": false},
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {"type": "linear"},
"scaleDistribution": { "type": "linear" },
"showPoints": "never",
"spanNulls": false,
"stacking": {"group": "A", "mode": "none"},
"thresholdsStyle": {"mode": "off"}
"stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" }
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null}
]
"steps": [{ "color": "green", "value": null }]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 4},
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 4 },
"id": 4,
"options": {
"legend": {"calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true},
"tooltip": {"mode": "single", "sort": "none"}
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "single", "sort": "none" }
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "rate(devpi_server_storage_cache_hits[5m])",
"legendFormat": "Storage Cache Hits",
"refId": "A"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "rate(devpi_server_storage_cache_misses[5m])",
"legendFormat": "Storage Cache Misses",
"refId": "B"
@ -235,44 +236,47 @@
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {"legend": false, "tooltip": false, "viz": false},
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {"type": "linear"},
"scaleDistribution": { "type": "linear" },
"showPoints": "never",
"spanNulls": false,
"stacking": {"group": "A", "mode": "none"},
"thresholdsStyle": {"mode": "off"}
"stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" }
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null}
]
"steps": [{ "color": "green", "value": null }]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 4},
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 4 },
"id": 5,
"options": {
"legend": {"calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true},
"tooltip": {"mode": "single", "sort": "none"}
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "single", "sort": "none" }
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "rate(devpi_server_changelog_cache_hits[5m])",
"legendFormat": "Changelog Cache Hits",
"refId": "A"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "rate(devpi_server_changelog_cache_misses[5m])",
"legendFormat": "Changelog Cache Misses",
"refId": "B"
@ -301,44 +305,47 @@
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {"legend": false, "tooltip": false, "viz": false},
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {"type": "linear"},
"scaleDistribution": { "type": "linear" },
"showPoints": "never",
"spanNulls": false,
"stacking": {"group": "A", "mode": "none"},
"thresholdsStyle": {"mode": "off"}
"stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" }
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null}
]
"steps": [{ "color": "green", "value": null }]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 12},
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 12 },
"id": 6,
"options": {
"legend": {"calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true},
"tooltip": {"mode": "single", "sort": "none"}
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "single", "sort": "none" }
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_web_whoosh_index_queue_size",
"legendFormat": "Index Queue Size",
"refId": "A"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_web_whoosh_index_error_queue_size",
"legendFormat": "Index Error Queue Size",
"refId": "B"
@ -360,15 +367,13 @@
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null}
]
"steps": [{ "color": "green", "value": null }]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 12},
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 12 },
"id": 7,
"options": {
"colorMode": "value",
@ -385,31 +390,31 @@
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_server_storage_cache_size",
"legendFormat": "Storage Cache Size",
"refId": "A"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_server_changelog_cache_size",
"legendFormat": "Changelog Cache Size",
"refId": "B"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_server_changelog_cache_items",
"legendFormat": "Changelog Cache Items",
"refId": "C"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_server_relpath_cache_size",
"legendFormat": "Relpath Cache Size",
"refId": "D"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"datasource": { "type": "prometheus", "uid": "prometheus" },
"expr": "devpi_server_relpath_cache_items",
"legendFormat": "Relpath Cache Items",
"refId": "E"