Improve type specifications and documentation

- Added missing type specifications for Hello function and rules - Updated documentation for the Deserialize protocol -
Cleaned up IBAN validation function documentation - Enhanced test fixture generation with clearer parsing and error
messages
This commit is contained in:
2025-12-02 11:14:40 -05:00
parent 71aa8cfde6
commit 492cb2378e
9 changed files with 41 additions and 43 deletions

View File

@@ -178,7 +178,7 @@ defp calculate_check_digits(country_code, bban) do
numeric =
rearranged
|> String.graphemes()
|> Enum.map(fn char ->
|> Enum.map_join(fn char ->
if char =~ ~r/[A-Z]/ do
[char_code] = String.to_charlist(char)
Integer.to_string(char_code - 55)
@@ -186,7 +186,6 @@ defp calculate_check_digits(country_code, bban) do
char
end
end)
|> Enum.join()
# Calculate mod 97
remainder =

View File

@@ -214,7 +214,7 @@ defp filter_by_numeric_only(specs, numeric_only) do
Enum.filter(specs, fn {_code, spec} ->
# Use numeric_only field if available, otherwise fall back to bban_spec check
case spec["numeric_only"] do
nil -> is_numeric_only?(spec["bban_spec"]) == numeric_only
nil -> numeric_only?(spec["bban_spec"]) == numeric_only
value -> value == numeric_only
end
end)
@@ -230,7 +230,7 @@ defp has_national_check?(spec) do
positions != nil and positions["start"] != positions["end"]
end
defp is_numeric_only?(bban_spec) do
defp numeric_only?(bban_spec) do
!String.contains?(bban_spec, ["!a", "!c"])
end
end