Skip to content

Conversation

@Wigny
Copy link

@Wigny Wigny commented Nov 13, 2025

After having worked on a similar solution that would allow me to generate a CodeClimate report for the mix credo diff command, I took the liberty of replicating these changes to this project so hopefully the community can also benefity from it.

While making the changes I noticed that the project is using old Elixir and deps versions, so I decided to bump them also, revamping the project.

Some of the changes included in this MR are:

  • increased the minimal supported Elixir version to 1.15 (as it is the minimum version still officially maintened);
  • made the Jason dependency optional as the JSON module is available now since Elixir v1.18;
  • updated the deps;
  • added support for generating the CodeClimate report when executing credo diff;
  • added tests and a CI workflow;

Please let me know if you desire me to split this MR in two smaller ones.

@Wigny Wigny changed the title Revamp the project and Revamp the project and add support for credo diff Nov 13, 2025
@Wigny Wigny force-pushed the revamp branch 4 times, most recently from 24a5625 to f88ce5f Compare November 13, 2025 19:31
Copy link
Owner

@hauleth hauleth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome. Just small little thing to handle.

_ -> exec
end
end
@json_lib if Code.ensure_loaded?(JSON), do: JSON, else: Jason
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make it more extensive check, to check that if JSON is not available, then Jason has to be available, otherwise it should fail.

Suggested change
@json_lib if Code.ensure_loaded?(JSON), do: JSON, else: Jason
@json_lib case do
Code.ensure_loaded?(JSON) -> JSON
Code.ensure_loaded?(Jason) -> Jason
true -> raise "No JSON encoder found, if you are using Elixir <= 1.17 then add `:jason` to your dependencies"
end

Or something like that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but instead of that, I just updated the dependencies list to always depend on :jason if running on an Elixir version lower than 1.18.

That should ensure Jason is always used on older Elixir versions, and that we rely on JSON on newer versions when Jason is not installed.

The mix compile --no-optional-deps check on CI should ensure that this config works on all versions.

@Wigny Wigny force-pushed the revamp branch 2 times, most recently from 34701cd to d699d07 Compare November 19, 2025 13:54
@Wigny Wigny requested a review from hauleth November 20, 2025 13:42
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.

2 participants