Revamp the project and add support for credo diff#1
Open
Wigny wants to merge 8 commits intohauleth:masterfrom
Open
Revamp the project and add support for credo diff#1Wigny wants to merge 8 commits intohauleth:masterfrom
credo diff#1Wigny wants to merge 8 commits intohauleth:masterfrom
Conversation
credo diff
24a5625 to
f88ce5f
Compare
hauleth
reviewed
Nov 17, 2025
Owner
hauleth
left a comment
There was a problem hiding this comment.
Looks awesome. Just small little thing to handle.
lib/credo_code_climate.ex
Outdated
| _ -> exec | ||
| end | ||
| end | ||
| @json_lib if Code.ensure_loaded?(JSON), do: JSON, else: Jason |
Owner
There was a problem hiding this comment.
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.
Author
There was a problem hiding this comment.
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.
34701cd to
d699d07
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After having worked on a similar solution that would allow me to generate a CodeClimate report for the
mix credo diffcommand, 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:
credo diff;Please let me know if you desire me to split this MR in two smaller ones.