LazyDoc (LazyDoc v0.5.1)

View Source

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

Returns a list of documentation for each function in the specified modules.

Returns the extracted data from files, including AST and documented functions.

Returns a list of names extracted from the given AST (Abstract Syntax Tree).

Returns the filtered list of functions that are documented and visible.

Returns a tuple containing the module, module AST, and a list of undocumented functions filtered from the input.

Returns a list of undocumented modules from the provided input.

Returns a map grouping function documentation by function name.

Returns a list of join codes derived from the given names.

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()

Returns a list of documentation for each function in the specified modules.

Parameters

  • modules - a list of module names to extract documentation from.

Description

Retrieves the documentation for functions in the given modules using Elixir's introspection capabilities.

extract_data_from_files()

Returns the extracted data from files, including AST and documented functions.

Parameters

  • None

Description

Processes files matching specified patterns and extracts their content, abstracts syntax tree, and documentation.

extract_names(ast)

Returns a list of names extracted from the given AST (Abstract Syntax Tree).

Parameters

  • ast - the AST to be traversed for extracting names.

Description

Traverses the AST and accumulates names of modules, protocols, and functions, returning them in a structured format.

filter_documented_functions(arg1, arg2)

Returns the filtered list of functions that are documented and visible.

Parameters

  • module - the module from which functions are being filtered.
  • module_ast - the abstract syntax tree of the module.
  • _code_mod - additional code modifications.
  • functions - the list of functions to be filtered.

Description

Filters the functions based on their documentation status.

filter_undocumented_functions(arg1, arg2)

Returns a tuple containing the module, module AST, and a list of undocumented functions filtered from the input.

Parameters

  • module - the module name for which undocumented functions are being filtered.
  • module_ast - the abstract syntax tree representation of the module.
  • _code_mod - unused code modification parameter.
  • functions - a list of functions in the module, where each function is represented as a tuple with its type and name.

Description

Filters the provided list of functions to retain only those that are undocumented.

filter_undocumented_modules(zip_to_process)

Returns a list of undocumented modules from the provided input.

Parameters

  • zip_to_process - a collection of modules and their associated documentation status.

Description

Filters through the provided modules to identify those without documentation and returns their details.

group_docs_different_arities(func_docs)

Returns a map grouping function documentation by function name.

Parameters

  • func_docs - a list of function documentation tuples.

Description

Groups the provided function documentation by their respective function names.

join_code_from_clauses(names)

Returns a list of join codes derived from the given names.

Parameters

  • names - a list of tuples where each tuple contains a type and a tuple of a name and a code.

Description

Processes the input list to merge codes based on matching names, creating a comprehensive output.