Files
Michael Chus a44133aff2 Move inline code examples out of normative contracts
identifier-normalization, no-hardcoded-vendors,
vendor-installer-verification, and build-version-display follow the
go-database split: rules in contract.md, snippets in README.md. Routed
contract reads get cheaper; examples stay available on demand. Lint now
also rejects stale kit/patterns references.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 10:00:02 +03:00
..

No Hardcoded Vendors Pattern Notes

This file keeps examples. The normative rules live in contract.md.

Запрещено

if device.Vendor == "Dell" { ... }
if strings.Contains(model, "PowerEdge") { ... }
switch vendor {
case "HP", "HPE", "Hewlett Packard": ...
}
// Запрещено — список вендоров в коде
var knownVendors = []string{"Dell", "HP", "Cisco", "Lenovo"}

Правильно

// Смотрим на возможности объекта, не на имя вендора
if device.HasIPMI { ... }
if device.ParserType == "redfish" { ... }

Маппинг в конфиге:

# config.yaml
vendor_parsers:
  dell:  redfish
  hp:    ilo
  cisco: ucs

Маппинг в БД:

SELECT parser_type FROM vendor_registry WHERE LOWER(vendor) = LOWER(?);