Releases: emkguts/quokka
Releases · emkguts/quokka
v2.13.1
Fixes
- Fix
Enum.reduce/3in a pipe being incorrectly rewritten to a nonexistent two-argumentEnum.sumcall. Pipedlhs |> Enum.reduce(acc, reducer)was styled asEnum.reduce/2and could emit invalidEnum.sum(acc)when the reducer was a simple sum. Fixes #160. - Fix autosort stealing comments from earlier in the module when sorting multi-line maps. Comments such as
# credo:disable-for-next-linein unrelated code could be detached from the lines they suppress. Fixes #161.
v2.13.0
Breaking Changes
- Sorting is now split into two independent mechanisms. See Autosort for the full comparison.
- Config autosort (maps, defstructs, schemas): controlled by
autosort: [...]and the:autosortstyle in:onlyor:exclude. # quokka:sort(per-value, opt-in): always runs; not affected by:only,:exclude, orexclude: [:autosort].
- Config autosort (maps, defstructs, schemas): controlled by
- If you use
:onlyor:excludeto limit which styles run, replace:comment_directiveswith:autosortto control config-driven sorting. Theautosort: [...]option is unchanged.
Improvements
- Added support for plugins; see
Quokka.Plugindocs for details on creating your own formatting rules. - Overhaul config-driven autosort: extracted into a dedicated style with its own docs. Maps with comments are now autosorted (comments stay with their keys). Use
# quokka:skip-sorton the line above a value to opt out. - Support
# quokka:sortfor struct field keys in@typedefinitions (e.g.@type t :: %__MODULE__{...}). - Respect Credo's
Credo.Check.Readability.OnePipePerLine— breaks pipe chains so each|>is on its own line when the check is enabled. - Respect Credo's
Credo.Check.Refactor.CondStatementsconfiguration. Set the check tofalseto disablecondsimplification. - Module directive skip comments (
# quokka:skip-module-directives,# quokka:skip-module-directive-reordering, etc.) now work insidedefimplblocks. Module directives indefimplanddefprotocolare reordered when no skip comment is present. - Respect Credo's
Credo.Check.Readability.StrictModuleLayoutignore_module_attributesandignore: [:module_attribute]options. When a module contains an ignored module attribute, Quokka preserves the original directive order for that module rather than hoisting directives above the attribute (which could be referenced by an earlier-ordered directive such as@moduledoc). Fixes #137. - Rewrite
Enum.reduce/2,3calls that simply sum their two arguments toEnum.sum/1(part of inefficient function rewrites). - Rewrite
Enum.drop/2+Enum.take/2toEnum.slice/3when both arguments are non-negative integer literals (part of inefficient function rewrites).
Fixes
- Fix alias duplication in
# quokka:skip-module-directive-reorderingmode when an existing alias was also referenced from non-alias content. - Fix crash when formatting empty modules (e.g. a
defmodulewith no body inside a quote block). - Fix autosort so comments above map keys are preserved correctly after sorting.
Deprecations
:comment_directivesis no longer a valid:onlyor:excludestyle. Use:autosortto control config-driven sorting instead.# quokka:sortalways runs and cannot be disabled.exclude: [:comment_directives]has no effect and logs a warning;only: [:comment_directives]no longer enables config autosort — add:autosortif you need it.
v2.12.1
v2.12.0
Breaking Changes
- Multi-alias sorting now matches Credo.Check.Readability.AliasOrder behavior by comparing the first child's full path instead of parent module only. This fixes compatibility with Credo 1.7.13+, which fixed a bug that now properly checks multi-alias ordering. Projects using Credo 1.7.12 or earlier may see new alias ordering changes when formatting. Upgrading to Credo 1.7.13+ is recommended for proper alias order checking.
Improvements
- Automatically fix
Credo.Check.Refactor.UtcNowTruncateby rewritingDateTime.utc_now() |> DateTime.truncate(precision)toDateTime.utc_now(precision). - Transform
Timex.today()toDate.utc_today(). - Rewrite
Map/Keyword.get(lhs, key, nil)toMap/Keyword.get(lhs, key). - Consecutive
Keyword.droporKeyword.deleterewrite toKeyword.dropas part of inefficient function rewrites. - Respect Credo's NegativeConditionsWithElse configuration.
- Add comment directive
# quokka:skip-module-directive-reorderingfor skipping module directive reordering to skip module directive reordering but still lift aliases, multi-alias expansion, etc. - Support piped function exclusions in SinglePipe rewrite.
- Support rewriting pipes within a
case ... doblock to instead pipe into case. Addexclude: [:pipe_into_case]to opt out of this behavior.
Fixes
- Fix invalid inefficient function rewrites on Map.reduce arguments.
- Sort nested module directives (e.g.,
alias A.{B, E, C}will be sorted toalias A.{B, C, E}).
Upgrades
- Upgrade credo to 1.7.16
- Add Elixir 1.19.1 and OTP 28.1.1 to CI checks
Deprecations
- Soft deprecate
quokka:skip-module-reorderingin favor ofquokka:skip-module-directives.
v2.11.2
v2.11.1
v2.11.0
Improvements
- Support
:onlyconfig option forCredo.Check.Design.AliasUsage. - Rewrite multiple
Map.deletetoMap.drop. - Rewrite
&my_func(&1)=>&my_func/1where relevant. - Rewrite
Enum.filter(fun) |> List.first([default])=>Enum.find([default], fun)
Fixes
- Set default Elixir version as empty string for language server compatibility.
- Do not dealias within moduledocs depending on the module layout order.
- Properly autosort embedded schema.
- Strict module layout styling fail for non-existent keys.
v2.10.0
v2.9.1
v2.9.0
Improvements
- Rewrite inefficient Repo existence checks (
Repo.one=>Repo.exists?where appropriate)
New rewrite type: tests
Quokka will style your tests. For now, the main rewrite is assert not gets rewritten to refute. If you don't want this rewrite, add exclude: [:tests].
Fixes
- In autosort, sort numeric keys naturally (ie, 1, 2, 10 instead of 1, 10, 2).
- Update mix.exs changelog link to use hexdocs.