Changelog

View Source

v0.7.1

v0.7.0

  • Added Jump.CredoChecks.NoWordSigilInterpolation, which flags interpolation inside lowercase word sigils (~w). The sigil splits on whitespace after interpolation, so quoting a phrase doesn't keep it together and interpolated values can unexpectedly become multiple list items. Use an explicit list instead.
  • Jump.CredoChecks.LiveViewFormCanBeRehydrated no longer crashes on embed_templates calls with options (e.g. embed_templates "templates/*", suffix: "_html") (#51).
  • Jump.CredoChecks.TestHasNoAssertions now counts calls to functions defined in the test file whose bodies assert, so tests built from helpers like then_it_shows(...) are no longer flagged.
  • Fixed two oversights in Jump.CredoChecks.DoctestIExExamples (cases we failed to catch iex> examples that never got doctested):
    • Examples in a nested module; each module with examples now needs its own doctest, since doctest MyApp.Outer doesn't run the examples in MyApp.Outer.Inner.
    • Fixed edge cases in how we parsed module names, so that we now resolve aliases (including alias ..., as: ...) correctly, and we do not treat commented-out doctest lines as passing.

v0.6.0

  • Added Jump.CredoChecks.AvoidModifyingStructBeforeChangeset, which flags structs that are modified (via %{struct | field: value}, Map.put/3, struct/2, a local helper function, etc.) before being passed into a changeset function. Values set this way aren't tracked as changes, so they bypass all changeset validation, and an update silently won't save them.

  • Two big improvements to Jump.CredoChecks.UseObanProWorker:
    • Flag process/1 callbacks that expect string keys in the job args when the worker declares an args_schema. (The args_schema ensures the worker will only ever be called with atom keys in the args.)
    • Add supported_worker_modules (default: [Oban.Pro.Worker]) so project-specific wrappers can be treated as equivalent to use Oban.Pro.Worker.
  • Jump.CredoChecks.UndeclaredExternalResource no longer treats an aliased module bound to the name File (alias MyApp.Files.File) as Elixir's File, so File.t() in a @spec no longer reports a missing @external_resource (#38).
  • Fixed a bug in Jump.CredoChecks.VacuousTest around as: aliases (#42)
  • Improvements to Jump.CredoChecks.AssertReceiveTimeout:
    • It now resolves a timeout held in a module attribute (@timeout 5_000) when the attribute is assigned once with an integer literal, instead of flagging it as unverifiable (#37).
    • Its max_refute_receive_timeout now also flags PhoenixTest refute_has calls that pass an explicit :timeout longer than the configured maximum.

v0.5.0

v0.4.0

Added 4 new checks:

  • Jump.CredoChecks.AssertReceiveTimeout, which flags assert_receive calls that specify an explicit timeout. Supports an optional min_assert_receive_timeout parameter that allows literal assert_receive timeouts greater than or equal to the configured minimum, and an optional max_refute_receive_timeout parameter that flags refute_receive calls whose timeout exceeds the configured maximum. (PR)
  • Jump.CredoChecks.ConditionalAssertion, which flags assertions that include an "or." Tests should be able to confidently assert which branch will be taken every time. (PR)
  • Jump.CredoChecks.UndeclaredExternalResource, which flags module attributes that read from the file system at compile time (e.g., File.read!/1) without declaring an @external_resource. Without it, editing the file won't trigger a recompile, leaving stale data baked into the module. (PR)
  • Jump.CredoChecks.SafeBinaryToTerm, which flags Plug.Crypto.non_executable_binary_to_term/2 calls that omit the :safe option. Decoding attacker-controlled input without :safe interns arbitrary atoms and can exhaust the atom table, crashing the node. (PR courtesy of first-time contributor @peaceful-james)

Dependency updates:

  • Igniter 0.8.0 -> 0.8.1
  • Credo 1.7.18 -> 1.7.19

v0.3.0

v0.2.0

  • Add Igniter task to support installing via mix igniter.install jump_credo_checks, courtesy of @britton-jb.
  • Add new Jump.CredoChecks.PreferChangeOverUpDownMigrations check, which detects Ecto migrations that define separate up/down callbacks but could instead take advantage of Ecto's automatic reversibility by using change/0.

v0.1.0

Initial release.