Documenter.jl - Warnings could use advice

Hey all I need some help understanding how to fix some warnings in my documentation.

I see a lot of these:


┌ Warning: Replacing docs for `ChemometricsTools.Center :: Tuple{Any}` in module `ChemometricsTools`
└ @ Base.Docs docs/Docs.jl:223

Not sure what it means or how I fix it?

Also some of these :

WARNING: Method definition MakeIntervals(Int64) in module ChemometricsTools at /src/Ensembles.jl:7 overwritten at

Which comes from methods which have different input types

"""
    MakeIntervals( columns::Int, intervalsize::Int = 20 )

Returns an 1-Array of intervals from the range: 1 - `columns` of size `intervalsize`.
"""
function MakeIntervals( columns::Int, intervalsize::Int = 20 )
    ...
end

"""
    MakeIntervals( columns::Int, intervalsize::Union{Array, Tuple} = [20, 50, 100] )

Creates an Dictionary whose key is the interval size and values are an array of intervals from the range: 1 - `columns` of size `intervalsize`.
"""
function MakeIntervals( columns::Int, intervalsizes::Union{Array, Tuple} = [20, 50, 100] )
...
end

Are these functions not legal?

1 Like

Documenter is not responsible for either of the warnings.
The problem is that you overwrite a method, which then overrides the docs. In particular, the MakeIntervals(::Int) method is overwritten here.

3 Likes

I am confused - can you elaborate a bit?

Can I not have functions of the same name with different input arguments/types?

My center function is confusing me too… Nothing overwrites it? Or is it because I documented a constructor function rather then the struct?

Here’s all references to Center in my package.

struct Center{B} <: Transform
    Mean::B
    invertible::Bool
end

"""
    Center(Z)

Acquires the mean of each column in `Z` provided and returns a transform that will subtract those column means from any future data.
"""
Center(Z) = Center( StatsBase.mean(Z, dims = 1), true )

"""
    (T::Center)(Z; inverse = false)

Centers data in array `Z` column-wise according to learned mean centers in Center object `T`.
"""
(T::Center)(Z; inverse = false) = (inverse) ? (Z .+ T.Mean) : (Z .- T.Mean)

Both those MakeIntervals methods have an optional second argument, so they both define what to do in the case of a single Int argument, and so the second one overwrites the first one for this case.

So yes, you can have functions of the same name with input arguments of different types, but in this case you actually define it for the same type of argument twice.

1 Like

Wow… I must be really tired. Appreciate that one.

I’ll have to look over the Center thing later to see what I’m doing.

1 Like

Okay interesting. Fixing that error fixed all the others? Great, I’ll take it. Thank you

1 Like