MetaCredo. Check. Utils
(MetaCredo v0.3.3)
View Source
Shared utilities for check implementations.
Provides function classification helpers to reduce false positives across security, observability, and other checks that match on function call names.
Summary
Functions
Collects string content from documentation attributes (@moduledoc, @doc,
@typedoc).
Returns true if a variable name represents a module attribute
(starts with @), which should be excluded from snake_case checks
since module attribute names follow their own conventions.
Returns true if the string looks like a module name (PascalCase or
contains dots like Enum.map), not a regular variable.
Returns true if the function name belongs to a well-known standard library module that should never be flagged as user-facing I/O, HTTP, auth, file operations, etc.
Returns true if a variable name is a well-known Elixir special form or compiler artifact that should be excluded from naming checks.
Functions
@spec doc_string_contents(Metastatic.AST.meta_ast()) :: MapSet.t(String.t())
Collects string content from documentation attributes (@moduledoc, @doc,
@typedoc).
Returns a MapSet of strings that appear as values of documentation module
attributes. Checks can use this to skip doc strings during literal analysis,
preventing false positives when documentation merely mentions patterns like
Phoenix.HTML.raw/1 or URL examples.
Returns true if a variable name represents a module attribute
(starts with @), which should be excluded from snake_case checks
since module attribute names follow their own conventions.
Returns true if the string looks like a module name (PascalCase or
contains dots like Enum.map), not a regular variable.
Returns true if the function name belongs to a well-known standard library module that should never be flagged as user-facing I/O, HTTP, auth, file operations, etc.
This prevents false positives like Keyword.get being flagged as an
HTTP "get" call, or Map.fetch! being flagged as a database "fetch".
Returns true if a variable name is a well-known Elixir special form or compiler artifact that should be excluded from naming checks.