Skip to content

Instantly share code, notes, and snippets.

@lelogrott
Last active December 3, 2017 14:05
Show Gist options
  • Select an option

  • Save lelogrott/6992e62b608630a9dbd8091534239880 to your computer and use it in GitHub Desktop.

Select an option

Save lelogrott/6992e62b608630a9dbd8091534239880 to your computer and use it in GitHub Desktop.
This script searches for occurrences of exported functions, listed on an input file, in the output of Documenter.jl that lists missing docstrings in the project. Prints the result and also generates an output file.
function filter_lines(line)
!startswith(line,"#") && !isempty(line)
end
FILE_exported_functions = open(ARGS[1], "r")
FILE_missing_docstrings = open(ARGS[2], "r")
FILE_output = open("output", "w")
exported_functions = readstring(FILE_exported_functions)
missing_docstrings = readstring(FILE_missing_docstrings)
lines = filter(filter_lines, split(exported_functions, "\n"))
functions = []
for line in lines
splited = split(line, r"\s*,\s*")
for function_prototype in splited
full_name = string("LightGraphs.", function_prototype, " :: ")
full_name_without_params = string("LightGraphs.", function_prototype, "\n")
if contains(missing_docstrings, full_name) || contains(missing_docstrings, full_name_without_params)
push!(functions, function_prototype)
write(FILE_output, "$full_name\n")
end
end
end
print(functions)
@lelogrott
Copy link
Author

lelogrott commented Dec 2, 2017

EXAMPLES
FILE_exported_functions:

# Interface
AbstractGraph, AbstractEdge, AbstractEdgeIter,
Edge, Graph, DiGraph, vertices, edges, edgetype, nv, ne, src, dst,
is_directed, add_vertex!, add_edge!, rem_vertex!, rem_edge!,
has_vertex, has_edge, in_neighbors, out_neighbors,

FILE_missing_docstrings:

Documenter: setting up build directory.
Documenter: expanding markdown templates.
Documenter: building cross-references.
Documenter: running document checks.
 > checking for missing docstrings.
 !! 4 docstrings potentially missing:

    LightGraphs.diffusion_rate :: Union{Tuple{Array{Array{T,1},1}}, Tuple{T}} where T<:Integer
    LightGraphs.Δin :: Tuple{Any}
    LightGraphs.degree
    LightGraphs.resetB! :: Tuple{Any}
!! Skipped doctesting.
 > checking footnote links.
Documenter: populating indices.
Documenter: rendering document.
Documenter: skipping docs deployment.
  You can set DOCUMENTER_DEBUG to "true" in Travis to see more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment