View Source Credo.Code.Module (Credo v1.6.3)

This module provides helper functions to analyse modules, return the defined functions or module attributes.

Link to this section Summary

Functions

Returns the list of aliases defined in a given module source code.

Reads an attribute from a module's ast

Returns the arity of the given function definition ast

Returns the function/macro count for the given module's AST

Returns the name of the function/macro defined in the given ast

Returns the {fun_name, op} tuple of the function/macro defined in the given ast

Returns the name of the functions/macros for the given module's ast

Returns the name of the functions/macros for the given module's ast

Returns the name of the functions/macros for the given module's ast if it has the given arity.

Returns the list of modules used in a given module source code.

Returns the name of a module's given ast node.

Link to this section Types

Specs

location() :: [line: pos_integer(), column: pos_integer()]

Specs

module_part() ::
  :moduledoc
  | :shortdoc
  | :behaviour
  | :use
  | :import
  | :alias
  | :require
  | :module_attribute
  | :defstruct
  | :opaque
  | :type
  | :typep
  | :callback
  | :macrocallback
  | :optional_callbacks
  | :public_fun
  | :private_fun
  | :public_macro
  | :private_macro
  | :public_guard
  | :private_guard
  | :callback_fun
  | :callback_macro
  | :module

Link to this section Functions

Returns the list of aliases defined in a given module source code.

Specs

analyze(Macro.t()) :: [{module(), [{module_part(), location()}]}]
Link to this function

attribute(ast, attr_name)

View Source

Reads an attribute from a module's ast

Returns the arity of the given function definition ast

Returns the function/macro count for the given module's AST

Returns the name of the function/macro defined in the given ast

Returns the {fun_name, op} tuple of the function/macro defined in the given ast

Link to this function

def_name_with_op(ast, arity)

View Source

Returns the name of the functions/macros for the given module's ast

Returns the name of the functions/macros for the given module's ast

Link to this function

def_names_with_op(ast, arity)

View Source

Returns the name of the functions/macros for the given module's ast if it has the given arity.

Returns the list of modules used in a given module source code.

Returns the name of a module's given ast node.