Skip to content

StyleError when module has @def attribute #75

@randycoulman

Description

@randycoulman

Versions

  • Elixir: use elixir --version
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.15.5 (compiled with Erlang/OTP 26)
  • Styler: use mix deps | grep locked | grep styler
  locked at 0.9.1 (styler) 28e3bb66

Example Input

https://github.com/randycoulman/mix_test_interactive/blob/v1.2.2/test/mix_test_interactive/pattern_filter_test.exs

I confirmed that the @def attribute in that file is the problem by renaming it to something else. When I did that, the problem went away.

Stacktrace / Current Behaviour

** (Styler.StyleError) Error running style Defs on test/mix_test_interactive/pattern_filter_test.exs
   Please consider opening an issue at: https://github.com/adobe/elixir-styler/issues/new
** (ArgumentError) ranges (first..last) expect both sides to be integers, got: 8..nil

    (elixir 1.15.5) lib/range.ex:193: Range.new/2
    (styler 0.9.1) lib/style/defs.ex:54: Styler.Style.Defs.run/2
    (styler 0.9.1) lib/zipper.ex:345: Styler.Zipper.do_traverse_while/3
    (styler 0.9.1) lib/styler.ex:36: anonymous fn/4 in Styler.style/3
    (elixir 1.15.5) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
    (styler 0.9.1) lib/styler.ex:34: Styler.style/3
    (styler 0.9.1) lib/styler.ex:64: Styler.format/3
    (elixir 1.15.5) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3

Skipping style and continuing on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions