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

Bump styler from 0.11.9 to 1.1.1 #39

Merged
merged 2 commits into from
Oct 12, 2024
Merged

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Oct 1, 2024

Bumps styler from 0.11.9 to 1.1.1.

Release notes

Sourced from styler's releases.

v1.0.0

1.0.0

Styler's two biggest outstanding bugs have been fixed, both related to compilation breaking during module directive organization. One was references to aliases being moved above where the aliases were declared, and the other was similarly module directives being moved after their uses in module directives.

In both cases, Styler is now smart enough to auto-apply the fixes we recommended in the old Readme.

Other than that, a slew of powerful new features have been added, the neatest one (in the author's opinion anyways) being Alias Lifting.

Thanks to everyone who reported bugs that contributed to all the fixes released in 1.0.0 as well.

Improvements

Alias Lifting

Along the lines of Credo.Check.Design.AliasUsage, Styler now "lifts" deeply nested aliases (depth >= 3, ala A.B.C....) that are used more than once.

Put plainly, this code:

defmodule A do
  def lift_me() do
    A.B.C.foo()
    A.B.C.baz()
  end
end

will become

defmodule A do
  @moduledoc false
  alias A.B.C
def lift_me do
C.foo()
C.baz()
end
end

To exclude modules ending in .Foo from being lifted, add styler: [alias_lifting_exclude: [Foo]] to your .formatter.exs

Module Attribute Lifting

A long outstanding breakage of a first pass with Styler was breaking directives that relied on module attributes which Styler moved after their uses. Styler now detects these potential breakages and automatically applies our suggested fix, which is creating a variable before the module. This usually happened when folks were using a library that autogenerated their moduledocs for them.

In code, this module:

... (truncated)

Changelog

Sourced from styler's changelog.

1.1.1

Improvements

  • unless: rewrite unless a |> b |> c as unless !(a |> b() |> c()) rather than unless a |> b() |> c() |> Kernel.!() (h/t @​gregmefford)

1.1.0

Improvements

The big change here is the rewrite/removal of unless due to unless "eventually" being deprecated. Thanks to @​janpieper and @​ypconstante for bringing this up in #190.

  • unless: rewrite all unless to if (#190)
  • pipes: optimize |> Stream.{each|map}(fun) |> Stream.run() to |> Enum.each(fun)

Fixes

  • pipes: optimizations reducing 2 pipes to 1 no longer squeeze all pipes onto one line (#180)
  • if: fix infinite loop rewriting negated if with empty do body if x != y, do: (), else: :ok (#196, h/t @​itamm15)

1.0.0

Styler's two biggest outstanding bugs have been fixed, both related to compilation breaking during module directive organization. One was references to aliases being moved above where the aliases were declared, and the other was similarly module directives being moved after their uses in module directives.

In both cases, Styler is now smart enough to auto-apply the fixes we recommended in the old Readme.

Other than that, a slew of powerful new features have been added, the neatest one (in the author's opinion anyways) being Alias Lifting.

Thanks to everyone who reported bugs that contributed to all the fixes released in 1.0.0 as well.

Improvements

Alias Lifting

Along the lines of Credo.Check.Design.AliasUsage, Styler now "lifts" deeply nested aliases (depth >= 3, ala A.B.C....) that are used more than once.

Put plainly, this code:

defmodule A do
  def lift_me() do
    A.B.C.foo()
    A.B.C.baz()
  end
end

will become

</tr></table> 

... (truncated)

Commits
  • 4aa18ba Don't pipe into Kernel.! when rewriting unless with pipes
  • 79dce09 update version in readme
  • 42b5d40 v1.1.0
  • 9125157 actually, lets only do not for in
  • 926ad51 use not over ! when rewriting unless a (> >= < <= in) b
  • cde90d3 Remove unless from codebases (#194)
  • d6c90cd fix infinite loop rewriting negated if with empty do body. closes #196
  • f2b269e Add Stream.run optimizations, fix optimizations shrinking pipes to one line (...
  • b4bca9c Merge pull request #192 from ktekinay/feature/fix-style-example
  • f53cf7c Update styles.md
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file elixir Pull requests that update Elixir code labels Oct 1, 2024
@dependabot dependabot bot requested a review from g-andrade October 1, 2024 16:42
Bumps [styler](https://github.com/adobe/elixir-styler) from 0.11.9 to 1.1.1.
- [Release notes](https://github.com/adobe/elixir-styler/releases)
- [Changelog](https://github.com/adobe/elixir-styler/blob/main/CHANGELOG.md)
- [Commits](adobe/elixir-styler@v0.11.9...v1.1.1)

---
updated-dependencies:
- dependency-name: styler
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/hex/styler-1.1.1 branch from f1d2b04 to 9387ccd Compare October 12, 2024 14:53
@g-andrade g-andrade merged commit 31a20a0 into main Oct 12, 2024
11 checks passed
@dependabot dependabot bot deleted the dependabot/hex/styler-1.1.1 branch October 12, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file elixir Pull requests that update Elixir code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant