Skip to content

Clean Code: improvements, review report, and project skill#37

Merged
stritti merged 3 commits into
mainfrom
refactor/clean-code-review
Jul 4, 2026
Merged

Clean Code: improvements, review report, and project skill#37
stritti merged 3 commits into
mainfrom
refactor/clean-code-review

Conversation

@stritti

@stritti stritti commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Clean Code Review & Project Skill

Dieser PR kombiniert zwei Dinge: (1) konkrete Clean-Code-Verbesserungen aus dem Code-Review, und (2) einen projekt-spezifischen Clean-Code-Skill für zukünftige Reviews.


Teil 1: Implementierte Clean-Code-Verbesserungen

DRY — Display Drawing extrahiert

Grad-Symbol (3× drawCircle) 6× → drawDegreeSymbol()
Pumpen-Icon 2× → drawPumpIcon()

Toter Code entfernt

  • NetworkManager::begin() — nie aufgerufen
  • Tote Member: apModeActive_, mdnsRunning_, hostname_
  • Unused Includes: IPAddress.h, ESPmDNS.h
  • static PoolMonitorContext* Self — nie gelesen

Weitere

  • Doppelter Kommentar entfernt
  • Konsistenter Funktionsstil (trailing return types)
  • HA-Topic-Konstanten: constexpr + k-Prefix
  • Leere Konstruktoren → = default

Teil 2: Clean Code Project Skill

Neue Datei .opencode/skills/clean-code/SKILL.md — ein projekt-spezifischer Skill mit:

  • 10 prüfbaren Clean-Code-Regeln (toter Code, DRY, Namenskonventionen, constexpr, Magic Numbers, Single Responsibility, Embedded Safety, Busy-Waits, Singletons, Include-Was-You-Use)
  • Automatisiertem Checker-Script (pio check, jscpd, grep-Patterns)
  • Review-Checkliste für Commit/PR-Gates
  • Referenz in AGENTS.md unter "Projekt-Skill: Clean Code"

Zukünftig vor jedem Commit/PR via skill("clean-code") laden.

Build

  • pio run — PASS
  • pio check — PASS

stritti added 3 commits June 28, 2026 02:00
- Rewrite users-guide.md (EN/DE) with correct title, display layout, OTA updates,
  time sync, and troubleshooting — previously used wrong title 'Pool Controller'
  and was outdated since 2022
- Fix _index.de.md missing space in summary field
- Fix project structure in software-guide.md (EN/DE) to match current
  src/PoolMonitor/ namespace layout
- Update library list to match platformio.ini (add ArduinoJson, fix PubSubClient)
- Remove duplicate power budget table in hardware-guide solar section (EN/DE)
- Remove out-of-place changelog from software-guide — belongs in CHANGELOG.md
- Fix heading hierarchy in home-assistant-migration.md
- Update Readme.md solar feature status as implemented, fix planned features
- Rewrite CONTRIBUTING.md with valid code-block languages (text), updated
  project structure, Docker note for make lint
- Fix _config.yml YAML indentation
- Update lastmod dates across all docs
…dead code removal

- Extract drawDegreeSymbol() and drawPumpIcon() helpers in DisplayManager
  to eliminate duplicated circle-drawing (6x → 2 calls) and pump icon logic
- Rename HA_TOPIC_* constants to C++ k-prefix convention with static constexpr
- Remove unused Self static pointer (dead code)
- Remove noise comments (obvious '// no copy', '// State variables', etc.)
- Normalize trailing return types in PoolMonitorContext.hpp for consistency
- Preserve all behavior: zero functional changes, verified by build
NetworkManager::begin() was never called anywhere in the codebase,
making it dead code along with its associated state members
(apModeActive_, mdnsRunning_, hostname_). The WiFi + mDNS
initialization is handled by WiFiSettings callbacks in
PoolMonitorContext::initializeNetwork().

Removed:
- NetworkManager::begin() declaration and implementation
- Dead static members: apModeActive_, mdnsRunning_, hostname_
- Unused includes: <IPAddress.h>, <ESPmDNS.h>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CPP Pass ✅
EDITORCONFIG Pass ✅
GITLEAKS Pass ✅
MARKDOWN Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@stritti stritti changed the title refactor: Clean Code improvements — DRY, naming, comments, dead code refactor: Clean Code improvements — DRY drawing, dead code removal, consistent style Jul 4, 2026
@stritti
stritti merged commit a5fafbc into main Jul 4, 2026
11 checks passed
@stritti stritti changed the title refactor: Clean Code improvements — DRY drawing, dead code removal, consistent style Clean Code: improvements, review report, and project skill Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant