Skip to content

Warn on non-CRLF line endings in ADIF multiline fields - #6

Merged
xylo04 merged 4 commits into
mainfrom
copilot/warn-on-line-ending-errors
Jun 5, 2026
Merged

Warn on non-CRLF line endings in ADIF multiline fields#6
xylo04 merged 4 commits into
mainfrom
copilot/warn-on-line-ending-errors

Conversation

Copilot AI commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

ADIF MultilineString fields must use CRLF for embedded line endings per spec section III.A. The checker now flags lone CR/LF in :M fields as warnings while continuing normal validation.

  • Validation path

    • Added a warning-capable validator path (validateADIFWithWarnings) that preserves existing fatal validation behavior.
    • Kept validateADIF as the error-only wrapper to avoid changing existing call semantics.
  • Multiline line-ending checks (:M only)

    • Scans multiline field payloads and emits warnings for:
      • \r not followed by \n
      • standalone \n
    • Accepts proper \r\n sequences without warning.
  • CLI output behavior

    • main now prints accumulated warnings to stderr.
    • Validation still succeeds when input is otherwise well-formed.
  • Coverage/docs

    • Added tests for CRLF (no warning), LF-only (warning), CR-only (warning), and non-M fields (no warning).
    • Updated README checks list to document multiline line-ending warnings.
warnings, err := validateADIFWithWarnings(data)
if err != nil {
	fmt.Fprintf(os.Stderr, "invalid ADIF: %v\n", err)
	os.Exit(1)
}
for _, warning := range warnings {
	fmt.Fprintf(os.Stderr, "warning: %s\n", warning)
}

@xylo04
xylo04 marked this pull request as ready for review June 5, 2026 23:30
@xylo04
xylo04 merged commit 972057a into main Jun 5, 2026
1 check passed
@xylo04
xylo04 deleted the copilot/warn-on-line-ending-errors branch June 5, 2026 23:31
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.

2 participants