mix lazy_doc.clean (LazyDoc v0.6.2)

View Source

The module Mix.Tasks.LazyDoc.Clean provides functionality to clean up documentation generated for Elixir projects by removing uncommitted changes, checking the state of the project, and managing documentation entries in the Abstract Syntax Tree (AST).

Description

This module defines a Mix task that automates the process of cleaning documentation for functions in Elixir modules. It starts by checking for any uncommitted changes in the Git repository, exiting if such changes are found to prevent data loss. If the project is clean, it proceeds to extract relevant documentation data from source files and removes specified function documentation from the AST based on information furnished by the LazyDoc application. The updated AST is then written back to the respective source files, overwriting the previous documentation entries.

Key functionality includes:

  • Starting the LazyDoc application.
  • Checking for a clean Git state before proceeding with documentation cleanup.
  • Extracting and processing ASTs to delete specified function documentation.
  • Writing the modified ASTs back to the original files to maintain up-to-date documentation consistency.

Summary

Functions

Returns a boolean indicating whether the working directory is clean.

Returns the updated AST after removing the specified function definition from the given module.

Returns the result of executing the _command_line_args through the LazyDoc application.

Functions

clean_tree?()

Returns a boolean indicating whether the working directory is clean.

Parameters

  • None

Description

Executes a system command to check for differences in the working directory.

delete_doc_from_ast(ast, module_ast, name_func)

Returns the updated AST after removing the specified function definition from the given module.

Parameters

  • ast - the original abstract syntax tree (AST) of the module.
  • module_ast - the AST representation of the target module.
  • name_func - the name of the function to be deleted from the AST.

Description

Traverses the AST to locate and remove a specified function definition from a given module's AST.

run(args)

Returns the result of executing the _command_line_args through the LazyDoc application.

Parameters

  • _command_line_args - command line arguments to be processed by the function.

Description

Handles the execution logic for documenting files and managing application configurations.