chore: upgrade stream_data#149
Conversation
| defp validate_selectors!([{_key, inner} | rest]), do: validate_selectors!(inner) and validate_selectors!(rest) | ||
| defp validate_selectors!([_key | rest]), do: validate_selectors!(rest) | ||
| defp validate_selectors!(other), do: raise ArgumentError, "select expects a list of keys but received: #{inspect other}" | ||
| defp validate_selectors!(other), do: raise(ArgumentError, "select expects a list of keys but received: #{inspect other}") |
| @@ -1,30 +0,0 @@ | |||
| # This file is responsible for configuring your application | |||
| # and its dependencies with the aid of the Mix.Config module. | |||
| use Mix.Config | |||
There was a problem hiding this comment.
Remove unused config file
| app: :norm, | ||
| version: @version, | ||
| elixir: "~> 1.7", | ||
| elixir: "~> 1.11", |
There was a problem hiding this comment.
The GH workflow file seems to be testing this matrix: elixir: [1.11], otp: [23.3]
I guess that matrix should be updated, but I prefer to ask first here first.
| assert {:error, errors} = conform(%User{name: :foo, age: "31", email: 42}, User.s()) | ||
|
|
||
| assert errors == [ | ||
| assert MapSet.equal?(MapSet.new(errors), MapSet.new([ |
There was a problem hiding this comment.
Unit test failing locally, at least with 1.17.0-rc.0-otp-27
| use Mix.Project | ||
|
|
||
| @version "0.13.0" | ||
| @source_url "https://github.com/elixir-toniq/norm" |
There was a problem hiding this comment.
Avoid duplicating this value, updated source url.
| [ | ||
| {:credo, "~> 1.4", only: [:dev, :test], runtime: false}, | ||
| {:stream_data, "~> 0.5", optional: true}, | ||
| {:stream_data, "~> 0.6 or ~> 1.0", optional: true}, |
There was a problem hiding this comment.
Main reason for this PR, updating stream_data that's causing some upgrade conflicts on my end.
.github/workflows/elixir.yml
Outdated
| elixir: [1.11] | ||
| otp: [23.3] | ||
| elixir: [1.16.1] | ||
| otp: [26.2] |
|
Can you bump the elixir and Erlang versions in the gha to OTP 25 and whatever the lowest version of elixir is that supports OTP 25 |
|
@mhanberg hey 👋 , thanks for taking a look at this. I already applied your suggestion. |
|
Hmm, I'm not sure why the actions runs are not respecting that. I'll take a look once I get back to my computer |
|
I see the results from the Analysis and Tests phase taking the right versions now. But let me look why credo is failing so abruptly and fix some failing unit tests. I will try to install the otp/elixir combination you suggested locally, probably I will not be able to do it because those are a bit old and I'm currently using an Apple M2, but let me try, I will report back. |
|
oh, i think my phone was just showing the required checks, so the new ones didn't show up |
| expected = if version().minor >= 13, | ||
| do: ~r/got: `@contract foo\(n\)`/, else: ~r/got: `@contract\(foo\(n\)\)`/ |
There was a problem hiding this comment.
I found this pattern while inspecting test/norm/core/selection_test.exs, so I decided to follow that approach to keep compatibility with previous versions.
| @@ -1,14 +1,14 @@ | |||
| %{ | |||
| "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, | |||
There was a problem hiding this comment.
After running mix hex.outdated, I noticed that everything was outdated, so, I decided to bump all the dependencies, most of them for development purposes (ex_doc and credo)
|
@mhanberg re: credo failures UPDATE: Credo it's fine up to Elixir 1.16, I was initially locally using v1.17-rc.0 and there is a change is in the elixir tokenizer. This is a little bit wtf, but here what's happening. If you run 11:19:48.165 [error] Task #PID<0.254.0> started from #PID<0.216.0> terminating
** (CaseClauseError) no case clause matching: {:ok, 63, 1, [], [{:eol, {62, 4, 1}}, {:end, {62, 1, nil}}, {:eol, {61, 6, 1}}, {:end, {61, 3, nil}}, {:eol, {60, 8, 1}}, {:end, {60, 5, nil}}, {:eol, {59, 63, 1}}, {:")", {59, 62, nil}}, {:"]", {59, 61, nil}}, {:bin_string, {59, 58, nil}, [">"]}, {:",", {59, 56, 0}}, {:")", {59, 55, nil}}, {:identifier, {59, 51, ~c"opts"}, :opts}, {:",", {59, 49, 0}}, {:identifier, {59, 44, ~c"specs"}, :specs}, {:., {59, 43, nil}}, {:identifier, {59, 38, ~c"union"}, :union}, {:"(", {59, 37, nil}}, {:paren_identifier, {59, 31, ~c"to_doc"}, :to_doc}, {:",", {59, 29, 0}}, {:bin_string, {59, 15, nil}, ["#Norm.OneOf<"]}, {:"[", {59, 14, nil}}, {:"(", {59, 13, nil}}, {:paren_identifier, {59, 7, ~c"concat"}, :concat}, {:eol, {58, 32, 1}}, {:do, {58, 30, nil}}, {:")", {58, 28, nil}}, {:identifier, {58, 24, ~c"opts"}, :opts}, {:",", {58, 22, 0}}, {:identifier, {58, 17, ~c"union"}, :union}, {:"(", {58, 16, nil}}, {:paren_identifier, {58, 9, ~c"inspect"}, :inspect}, {:identifier, {58, 5, ~c"def"}, :def}, {:eol, {56, 27, 2}}, {:alias, {56, 20, ~c"Algebra"}, :Algebra}, {:., {56, 19, nil}}, {:alias, {56, 12, ~c"Inspect"}, :Inspect}, {:identifier, {56, 5, ~c"import"}, :import}, {:eol, {55, 21, 1}}, {:do, {55, 19, nil}}, {:alias, {55, 11, ...}, :Inspect}, {:identifier, {55, ...}, :defimpl}, {:eol, {...}}, {:end, ...}, {...}, ...], []}
(credo 1.7.6) lib/credo/code.ex:138: Credo.Code.to_tokens/2
(credo 1.7.6) lib/credo/check/readability/large_numbers.ex:43: Credo.Check.Readability.LargeNumbers.run/2
(credo 1.7.6) lib/credo/check/readability/large_numbers.ex:2: Credo.Check.Readability.LargeNumbers.do_run_on_source_file/3
(elixir 1.17.0-rc.0) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.17.0-rc.0) lib/task/supervised.ex:36: Task.Supervised.reply/4
Function: &:erlang.apply/2
Args: [#Function<2.75132833/1 in Credo.Check.Readability.LargeNumbers.do_run_on_all_source_files/3>, [%SourceFile<lib/norm/core/any_of.ex>]]So, I went to the credo code, and certainly noticed the mismatch here: def to_tokens(source, filename \\ "nofilename") when is_binary(source) do
source
|> String.to_charlist()
|> :elixir_tokenizer.tokenize(1, file: filename)
|> case do
# Elixir < 1.6
{_, _, _, tokens} ->
tokens
# Elixir >= 1.6
{:ok, tokens} ->
tokens
# Elixir >= 1.13
{:ok, _, _, _, tokens} ->
tokens
{:error, _, _, _, tokens} ->
tokens
end
endSo, I did modified that file with this diff: # diff lib/credo/code.ex.bak lib/credo/code.ex
148c148
< {:ok, _, _, _, tokens} ->
---
> {:ok, _, _, _, tokens, _} ->Run So, let me fix those issues first and then see if credo introduced a bug at some point or whatever. |
.credo.exs
Outdated
| {Credo.Check.Consistency.ExceptionNames, []}, | ||
| {Credo.Check.Consistency.LineEndings, []}, | ||
| {Credo.Check.Consistency.ParameterPatternMatching, []}, | ||
| {Credo.Check.Consistency.SpaceAroundOperators, []}, |
There was a problem hiding this comment.
I think you actually altered the configured checks when you updated the config, do you mind ensuring the same checks enabled as before?
|
Sorry, one last ask. Can you revert any unrelated style changes or credo changes that were due to the checks being changed? |
|
Hey @milmazz! 🖖 Sorry for the ping, but is there any update on this? If you need (and allow me to), I can open a separate pull request cherry-picking your fixes for the compilation warnings. |
9de8549 to
698c913
Compare
|
@antedeguemon Thanks for the ping! I updated this branch and now we should be ready for another review from @mhanberg |
|
Looks like just needs some credo fixes and I think it's good to go |
|
Those are the credo changes you asked to remove in your previous comment @mhanberg |
What i was previously referring to was changing the credo config file so that it added/removed checks, requiring other code changes. The ones that are currently failing are from updating Credo, as the MapJoin check was added after the previous version of Credo we were on. These ones are new default credo checks and i'm okay with fixing those. |
|
@mhanberg To move on with this discussion, I put it back the refactoring opportunities found by credo. |



This PR also include the following changes:
erlef/setup-beamaction can't find the original otp 23.3)config/config.exsfilecredofindings after the upgrade