View Source Credo.CLI.Filename (Credo v1.6.7)

This module can be used to handle filenames given at the command line.

Link to this section Summary

Functions

Returns true if a given filename contains a pos_suffix.

Returns a suffix for a filename, which contains a line and column value.

Removes the pos_suffix for a filename.

Adds a pos_suffix to a filename.

Link to this section Functions

Link to this function

contains_line_no?(filename)

View Source

Returns true if a given filename contains a pos_suffix.

iex> Credo.CLI.Filename.contains_line_no?("lib/credo/sources.ex:39:8")
true

iex> Credo.CLI.Filename.contains_line_no?("lib/credo/sources.ex:39")
true

iex> Credo.CLI.Filename.contains_line_no?("lib/credo/sources.ex")
false
Link to this function

pos_suffix(line_no, column)

View Source

Returns a suffix for a filename, which contains a line and column value.

iex> Credo.CLI.Filename.pos_suffix(39, 8)
":39:8"

iex> Credo.CLI.Filename.pos_suffix(39, nil)
":39"

These are used in this way: lib/credo/sources.ex:39:8

Link to this function

remove_line_no_and_column(filename)

View Source

Removes the pos_suffix for a filename.

iex> Credo.CLI.Filename.remove_line_no_and_column("lib/credo/sources.ex:39:8")
"lib/credo/sources.ex"

Adds a pos_suffix to a filename.

iex> Credo.CLI.Filename.with("test/file.exs", %{:line_no => 1, :column => 2})
"test/file.exs:1:2"