Credo v1.1.0 Credo.Code.Scope View Source

This module provides helper functions to determine the scope name at a certain point in the analysed code.

Link to this section Summary

Functions

Returns the module part of a scope

Returns the scope for the given line as a tuple consisting of the call to define the scope (:defmodule, :def, :defp or :defmacro) and the name of the scope

Link to this section Functions

Returns the module part of a scope.

iex> Credo.Code.Scope.mod_name("Credo.Code")
"Credo.Code"

iex> Credo.Code.Scope.mod_name("Credo.Code.ast")
"Credo.Code"

Returns the scope for the given line as a tuple consisting of the call to define the scope (:defmodule, :def, :defp or :defmacro) and the name of the scope.

Examples:

{:defmodule, "Foo.Bar"}
{:def, "Foo.Bar.baz"}