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

Fix file detection paths in Elixir 1.16 #42

Merged

Conversation

ypconstante
Copy link
Contributor

In Elixir 1.16 the file detection paths have an additional ../ in front, causing the detection to fail.

This PR fixes this by changing from Path.relative_to(".") to Path.relative_to_cwd().

find_failed_detection before

[(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2]
...
|> Keyword.get(:detect, []) #=> [file: "test"]
|> Enum.map(&split_detection_opts/1) #=> [{{:file, "test"}, []}]
|> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, "../test"}, []}]
|> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> {{:file, "../test"}, []}

...

[(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2]
...
|> Keyword.get(:detect, []) #=> [file: ".formatter.exs"]
|> Enum.map(&split_detection_opts/1) #=> [{{:file, ".formatter.exs"}, []}]
|> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, "../.formatter.exs"}, []}]
|> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> {{:file, "../.formatter.exs"}, []}

find_failed_detection after

[(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2]
...
|> Keyword.get(:detect, []) #=> [file: "test"]
|> Enum.map(&split_detection_opts/1) #=> [{{:file, "test"}, []}]
|> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, "test"}, []}]
|> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> nil

...

[(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2]
...
|> Keyword.get(:detect, []) #=> [file: ".formatter.exs"]
|> Enum.map(&split_detection_opts/1) #=> [{{:file, ".formatter.exs"}, []}]
|> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, ".formatter.exs"}, []}]
|> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> nil

Fixes #41

@ypconstante
Copy link
Contributor Author

@karolsluszniak can you check this PR, now that Elixir 1.16 got released?

@ypconstante ypconstante closed this Feb 1, 2024
@karolsluszniak karolsluszniak merged commit fc5dfe6 into karolsluszniak:master Feb 29, 2024
1 of 2 checks passed
@karolsluszniak
Copy link
Owner

Sorry for the delay & thank you for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test and formatter not running with Elixir v1.16.0-rc.0
2 participants