View Source Credo.SourceFile (Credo v1.7.2-rc.4)

SourceFile structs represent a source file in the codebase.

Summary

Functions

Returns the AST for the given source_file.

Returns the column of the given trigger inside the given line.

Returns the line at the given line_no.

Returns the snippet at the given line_no between column1 and column2.

Returns the lines of source code for the given source_file.

Returns a SourceFile struct for the given source code and filename.

Returns the source code for the given source_file.

Returns the source code and filename for the given source_file_or_source.

Types

@type t() :: %Credo.SourceFile{
  filename: nil | String.t(),
  hash: String.t(),
  status: :valid | :invalid | :timed_out
}

Functions

Returns the AST for the given source_file.

Link to this function

column(source_file, line_no, trigger)

View Source

Returns the column of the given trigger inside the given line.

NOTE: Both line_no and the returned index are 1-based.

Link to this function

line_at(source_file, line_no)

View Source

Returns the line at the given line_no.

NOTE: line_no is a 1-based index.

Link to this function

line_at(source_file, line_no, column1, column2)

View Source

Returns the snippet at the given line_no between column1 and column2.

NOTE: line_no is a 1-based index.

Returns the lines of source code for the given source_file.

Returns a SourceFile struct for the given source code and filename.

Returns the source code for the given source_file.

Link to this function

source_and_filename(source_file_or_source, default_filename \\ "nofilename")

View Source

Returns the source code and filename for the given source_file_or_source.

@spec timed_out(String.t()) :: t()