Skip to content

Commit e78f6ed

Browse files
committed
tweak warning for bad docstrings
1 parent 7cd0ecf commit e78f6ed

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/metadata_utils.jl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ function _extend!(program::Expr, trait::Symbol, value, T)
6565
end
6666
end
6767

68-
const DEPWARN_DOCSTRING =
69-
"`metadata_model` should not be called with the keyword argument "*
70-
"`descr` or `docstring`. Implementers of the MLJ model interface "*
71-
"should instead create an MLJ-compliant docstring in the usual way. "*
72-
"See https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/#Document-strings for details. "
68+
const depwarn_docstring(T) =
69+
"""
7370
74-
"""
71+
Regarding $T: `metadata_model` should not be called with the keyword argument `descr`
72+
or `docstring`. Implementers of the MLJ model interface should instead create an
73+
MLJ-compliant docstring in the usual way. See
74+
https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/#Document-strings
75+
for details.
76+
77+
"""
7578
metadata_model(T; args...)
7679

7780
Helper function to write the metadata for a model `T`.
@@ -122,7 +125,7 @@ function metadata_model(
122125
supports_training_losses::Union{Nothing,Bool}=nothing,
123126
reports_feature_importances::Union{Nothing,Bool}=nothing,
124127
)
125-
docstring === nothing || Base.depwarn(DEPWARN_DOCSTRING, :metadata_model)
128+
docstring === nothing || Base.depwarn(depwarn_docstring(T), :metadata_model)
126129
127130
program = quote end
128131

0 commit comments

Comments
 (0)