How to disable a particular compiler warning? (@doc on private function)

As I refactor my app, I sometimes make a public function private. When I do, I get the warning,

warning: defp func/1 is private, @doc attribute is always discarded for private functions/macros/types

This isn’t helpful; it’s a false positive. The only way I’ve found to avoid the warning is to manually convert the function doc to use #-style comments. And then of course, if I decide to make the function public again, I have to reformat the comment. It’s a little tedious.

Anyhow, I’d like to be able to simply disable this warning entirely in my project. But I haven’t found a configuration for disabling any warning, only a select few.

This has been discussed before:

I’d also like an official way to document private functions but in the meantime I tend to do this (as it makes it easy to preserve docs when making public functions private):

#@doc "This private function does X because Y"

2 Likes