Pote.Validator.Bracket (Pote v3.0.0)

Copy Markdown View Source

Bracket-style detection for color format strings.

Splits out the bracket-style heuristic from Pote.Validator so that the validator remains focused on value parsing.

Not part of the public API — used only by Pote.Validator.

Format rules

Most color formats use parentheses (rgb:R,G,B), not curly braces. This helper detects the common typo rgb:{R,G,B} and returns an informative error.

Currently supported: rgb, argb, hsl, hsv, cmyk. Other formats return nil (no bracket-specific advice).

Summary

Functions

Checks if code uses curly braces instead of parentheses.

Functions

check_bracket_style(code, format)

@spec check_bracket_style(String.t(), String.t()) ::
  {:error, atom(), String.t()} | nil

Checks if code uses curly braces instead of parentheses.

Returns:

  • {:error, atom(), String.t()} — bracket-style mismatch error
  • nil — no bracket issue detected (or format doesn't care)