Credence.Rule.NoTrailingNewlineInDoc
(credence v0.3.0)
Copy Markdown
Detects @doc, @moduledoc, and @typedoc strings that contain a
trailing \n escape sequence.
LLMs frequently generate documentation strings with a trailing \n
because Python docstrings use trailing newlines. In Elixir, the closing
" or """ handles line termination — the \n produces an
unnecessary blank line in the rendered documentation.
Bad
@doc "Finds the missing number in a list.\n"
@moduledoc "A module for palindrome checking.\n"Good
@doc "Finds the missing number in a list."
@moduledoc "A module for palindrome checking."Auto-fix
Strips trailing \n escape sequences from single-line doc strings.
Heredoc-style docs ("""...""") are not modified.