Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect compositions of {Naive}DateTime.utc_now and {Naive}DateTime.truncate #1074

Merged

Commits on Oct 1, 2023

  1. Add refactoring check suggesting to pass time unit to {Naive}DateTime…

    ….utc_now
    
    Instead of calling DateTime.utc_now and then truncating the result with
    DateTime.truncate/2, it's more efficient (and less code) to just pass a
    time unit indicating the desired precision to DateTime.utc_now directly.
    
    Dito for NaiveDateTime.
    frerich committed Oct 1, 2023
    Configuration menu
    Copy the full SHA
    1a28a23 View commit details
    Browse the repository at this point in the history
  2. Enable Credo.Check.Refactor.UtcNowTruncate check by default

    I believe this refactoring is universally plausible, so let's enable it
    by default.
    frerich committed Oct 1, 2023
    Configuration menu
    Copy the full SHA
    bff1668 View commit details
    Browse the repository at this point in the history

Commits on Dec 16, 2023

  1. Update lib/credo/check/refactor/utc_now_truncate.ex

    Co-authored-by: René Föhring <[email protected]>
    frerich and rrrene committed Dec 16, 2023
    Configuration menu
    Copy the full SHA
    ef89703 View commit details
    Browse the repository at this point in the history
  2. Update lib/credo/check/refactor/utc_now_truncate.ex

    Co-authored-by: René Föhring <[email protected]>
    frerich and rrrene committed Dec 16, 2023
    Configuration menu
    Copy the full SHA
    46e9ca6 View commit details
    Browse the repository at this point in the history
  3. More specific error messages

    frerich committed Dec 16, 2023
    Configuration menu
    Copy the full SHA
    155b9d5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    728bf4d View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2023

  1. Corrected trigger

    This should be a quote from the source code,
    Credo.Check.add_column_if_missing/5 relies on this to calculate the
    column value for the issue.
    frerich committed Dec 29, 2023
    Configuration menu
    Copy the full SHA
    aa498e1 View commit details
    Browse the repository at this point in the history
  2. Correct line number for reported issues

    The `line_no` value should be the line where the `trigger` appears, i.e.
    we should be using the meta information of the `truncate` AST node here.
    frerich committed Dec 29, 2023
    Configuration menu
    Copy the full SHA
    301397d View commit details
    Browse the repository at this point in the history