LazyDoc (LazyDoc v0.4.1)

## Main functionality

The module LazyDoc provides a way to extract and organize documentation from Elixir source files by reading them, parsing their abstract syntax tree (AST), and collecting relevant information about modules, functions, and comments.

## Description

It implements functions to read files matching a given path pattern, extract their AST and comments, group function definitions by names and arities, filter out undocumented functions and modules, and retrieve associated documentation for the extracted modules. The module serves as a utility for generating or managing documentation for Elixir projects.

Summary

Functions

Parameters

Parameters

  • zip_to_process - a list of tuples containing module information and their documentation.

Description

Filters the given list of modules and returns those that do not have associated documentation.

Functions

docs_per_module(modules)

@spec docs_per_module([module(), ...]) :: [
  {module :: module(), module_doc :: doc_content, docs :: [doc_element]},
  ...
]
when annotation: :erl_anno.anno(),
     doc_content: %{optional(binary()) => binary()} | :none | :hidden,
     doc_element:
       {{kind :: atom(), function_name :: atom(), arity()}, annotation,
        signature, doc_content, metadata},
     signature: [binary()],
     metadata: map()

Parameters

modules - a list of modules to fetch documentation for. Description Retrieves documentation for the given modules, filtering out functions with no documentation.

Returns a list of tuples containing the documentation for each module including functions.

extract_data_from_files()

Parameters

path_wildcard - a string pattern used to match file paths for reading. Description Reads files that match the given wildcard pattern, extracts their abstract syntax tree (AST), comments, and function definitions.

Returns a list of maps containing details about each file, including the content, AST, modules, functions, and comments extracted.

extract_names(ast)

Parameters

ast - an abstract syntax tree (AST) structure representing the source code. Description Initiates the extraction of names from the given AST.

Returns a list of names extracted from the AST.

filter_undocumented_functions(arg1, arg2)

Parameters

list_nodes - a list containing nodes which include functions list_undocumented_functions - a list of functions identified as undocumented.

Description Filters a list of nodes to find those that correspond to undocumented functions.

Returns a list of nodes that are undocumented functions present in list_nodes.

filter_undocumented_modules(zip_to_process)

Parameters

  • zip_to_process - a list of tuples containing module information and their documentation.

Description

Filters the given list of modules and returns those that do not have associated documentation.

Returns

A list of tuples containing modules and their respective AST and code without documentation.

group_docs_different_arities(func_docs)

Parameters

func_docs - a list of function documentation tuples, where each tuple contains the function name, line number, signature, and documentation string. Description Groups function documentation by their names in order to organize and access documentation for functions with different arities.

Returns a map where the keys are function names and the values are lists of their corresponding documentation strings.

join_code_from_clauses(names)

Parameters

names - a list of tuples where each tuple contains a type and a value. The type indicates the kind of element (e.g., :function) and the value is related to that type. Description Joins code from function clauses based on their names, merging the code of functions with the same name.

Returns a list of elements where functions with the same name are combined into a single tuple with their code concatenated.