testsAndMisc/scripts
Krzysztof kuhy Rudnicki 59e863f2a5 feat: Add shell script quality enforcement and polling optimization guidelines
- Add pre-commit hook (check_polling_antipatterns.sh) to detect fork-storm anti-patterns
- Update .pre-commit-config.yaml with no-polling-antipatterns hook registration
- Add comprehensive documentation (6 guides, 1000+ lines total)

Detects and blocks:
  * while true + sleep patterns (suggests event-driven I/O)
  * $(date +...) subprocess forks (suggests /proc/uptime or bash printf)
  * pgrep/xdotool in polling functions (expensive fork overhead)
  * aggressive polling (sleep < 1s causing fork storms)
  * heavy piped commands (| awk | grep | tr with multiple forks)

Documentation included:
  - SHELL_SCRIPT_QUALITY_GUIDELINES.md: 3-layer guide for developers/reviewers
  - SHELL_QUALITY_IMPLEMENTATION_SUMMARY.md: Technical implementation reference
  - COMPLETE_IMPLEMENTATION_SUMMARY.md: Full overview and integration guide
  - QUICK_REFERENCE_SHELL_QUALITY.md: Visual checklist and quick lookup
  - DELIVERABLES_INDEX.md: Index of all deliverables and next steps
  - shell.instructions.md: R1-R8 polling optimization rules (in ~/.copilot/instructions/)

System impact:
  - Prevents new scripts from introducing fork-storm regressions
  - Already active optimizations: network_monitor.sh zero-fork, battery 1s->5s, music adaptive sleep
  - Expected daily savings: ~1-2 CPU-hours from eliminated fork overhead

Related: Resolves previous fork-storm issue identified on May 3 causing 728k CPU-seconds
2026-05-03 21:42:49 +02:00
..
run_all feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
check_c_cpp_build_files.sh feat: added run sh and makefile scripts 2026-02-22 22:00:50 +01:00
check_no_binaries.sh chore: optimize pre-commit, remove tracked binaries, fix lint issues 2026-04-10 18:48:37 +02:00
check_no_secrets.sh fix: bluetooth optimze arch desktop phone foucs mode and no secres 2026-03-02 19:13:22 +01:00
check_polling_antipatterns.sh feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
check_python_location.sh Add VS Code auto-optimizer and selective pytest pre-commit hook 2026-03-25 21:56:37 +01:00
disk_cleanup_check.sh chore: optimize pre-commit, remove tracked binaries, fix lint issues 2026-04-10 18:48:37 +02:00
makepkg-manual-dlagent.sh fix: bluetooth optimze arch desktop phone foucs mode and no secres 2026-03-02 19:13:22 +01:00
optimize_vscode.py Add VS Code auto-optimizer and selective pytest pre-commit hook 2026-03-25 21:56:37 +01:00
pytest_changed_packages.py Fix coverage SQLite corruption: isolate each package run with COVERAGE_FILE 2026-04-12 21:58:18 +02:00