MetaCredo.Sources (MetaCredo v0.1.0)

View Source

Discovers and parses source files for analysis.

Maps file extensions to languages, uses Metastatic.Adapter to parse source code into MetaAST, and wraps results in MetaCredo.SourceFile structs.

Summary

Functions

Finds and parses source files matching the given configuration.

Returns the language for a file based on its extension.

Returns the set of supported file extensions.

Functions

find(paths)

@spec find(map() | String.t() | [String.t()]) :: [MetaCredo.SourceFile.t()]

Finds and parses source files matching the given configuration.

Also accepts a plain string or list of strings for convenience:

MetaCredo.Sources.find("lib/")
MetaCredo.Sources.find(["lib/", "src/"])

language_for(filename)

@spec language_for(String.t()) :: atom() | nil

Returns the language for a file based on its extension.

supported_extensions()

@spec supported_extensions() :: [String.t()]

Returns the set of supported file extensions.