Basics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of higher and works with any version of Elixir.
Explanation
Avoid ~T[23:59:59] as an end-of-day bound.
Examples
Avoid:
occurred_at >= day_start and occurred_at <= ~T[23:59:59]Prefer:
occurred_at >= day_start and occurred_at < next_day_startNotes
An inclusive 23:59:59 bound misses values with fractional seconds, such
as 23:59:59.500000. That creates edge-case bugs for timestamp and time
comparisons.
Use the next day's midnight as an exclusive upper bound. Half-open ranges include every representable time in the day without guessing precision.
Path exclusions are matched against the source filename and are intended for generated files or temporary migration areas.
The check uses static AST analysis, so dynamic code generation and macro-expanded code may fall outside its signal.
Options
Configure options in .credo.exs with the check tuple:
%{
configs: [
%{
name: "default",
checks: [
{Bylaw.Credo.Check.Elixir.NoEndOfDayTime,
[
excluded_paths: ["test/support/"]
]}
]
}
]
}:excluded_paths- Paths containing any configured string are skipped. Defaults totest/so fixtures and assertions can still describe boundary values directly.
Usage
Add this check to Credo's checks: list in .credo.exs:
%{
configs: [
%{
name: "default",
checks: [
{Bylaw.Credo.Check.Elixir.NoEndOfDayTime, []}
]
}
]
}Check-Specific Parameters
Use the following parameters to configure this check:
:excluded_paths
Paths containing any configured string are skipped. Defaults to test/
so fixtures and assertions can still describe boundary values directly.
This parameter defaults to ["test/"].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.