LazyDoc.Util (LazyDoc v0.6.2)

View Source

The module LazyDoc provides an interface for extracting and processing documentation and code information from Elixir source files.

Description

It implements functionality to scan Elixir source files within a specified path, extract module and function definitions, group related functions by name (taking arity into account), and filter undocumented or documented functions and modules. The primary purpose of LazyDoc is to facilitate the automation of generating documentation by analyzing source code, managing documentation for function overloads, and providing insights into which parts of the codebase are lacking documentation.

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 a list of functions filtered based on documentation presence in the given module.

Returns a tuple containing the module, its AST, and undocumented functions.

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.

Returns a list of paths to load module files and configurations, raising an error if the project is not compiled in development mode.

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(module_tuple, mod_docs)

Returns a list of functions filtered based on documentation presence in the given module.

Parameters

  • module - the module from which to filter functions.
  • module_ast - the abstract syntax tree of the module.
  • _code_mod - additional code modification parameters (not used directly).
  • functions - the list of functions to be filtered based on their documentation.

Description

Filters functions to include only those that are documented and not marked as hidden or non-existent in the documentation.

filter_undocumented_functions(module_tuple, mod_docs)

Returns a tuple containing the module, its AST, and undocumented functions.

Parameters

  • module - the module from which to filter functions.
  • module_ast - the abstract syntax tree (AST) of the module.
  • _code_mod - unused parameter, typically the code modification context.
  • functions - a list of functions within the module.

Description

Filters the provided functions to return 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.

load_modules_and_conf()

Returns a list of paths to load module files and configurations, raising an error if the project is not compiled in development mode.

Parameters

  • None

Description

Loads all module paths and relevant configuration settings from the project's configuration files if they exist.