View Source Credo.Code (Credo v1.7.0)
Credo.Code
contains a lot of utility or helper functions that deal with the
analysis of - you guessed it - code.
Whenever a function serves a general purpose in this area, e.g. getting the
value of a module attribute inside a given module, we want to extract that
function and put it in the Credo.Code
namespace, so others can utilize them
without reinventing the wheel.
Link to this section Summary
Functions
Returns an AST for a given String
or Credo.SourceFile
.
Takes a SourceFile and returns its source code stripped of all Strings and Sigils.
Takes a SourceFile and returns its source code stripped of all Strings, Sigils and code comments.
Returns true if the given child
AST node is part of the larger
parent
AST node.
Postwalks a given Credo.SourceFile
's AST or a given AST.
Prewalks a given Credo.SourceFile
's AST or a given AST.
Returns an AST without its metadata.
Converts a String or Credo.SourceFile
into a List of tuples of {line_no, line}
.
Converts a String or Credo.SourceFile
into a List of tokens using the :elixir_tokenizer
.
Link to this section Functions
Returns an AST for a given String
or Credo.SourceFile
.
Takes a SourceFile and returns its source code stripped of all Strings and Sigils.
clean_charlists_strings_sigils_and_comments(source_file_or_source, sigil_replacement \\ " ")
View SourceTakes a SourceFile and returns its source code stripped of all Strings, Sigils and code comments.
Returns true if the given child
AST node is part of the larger
parent
AST node.
Postwalks a given Credo.SourceFile
's AST or a given AST.
Technically this is just a wrapper around Macro.postwalk/3
.
Prewalks a given Credo.SourceFile
's AST or a given AST.
Technically this is just a wrapper around Macro.prewalk/3
.
Returns an AST without its metadata.
Converts a String or Credo.SourceFile
into a List of tuples of {line_no, line}
.
Converts a String or Credo.SourceFile
into a List of tokens using the :elixir_tokenizer
.