-
Notifications
You must be signed in to change notification settings - Fork 2
Revamp the project and add support for credo diff
#1
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
base: master
Are you sure you want to change the base?
Conversation
credo diff
24a5625 to
f88ce5f
Compare
hauleth
left a comment
There was a problem hiding this 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.
lib/credo_code_climate.ex
Outdated
| _ -> exec | ||
| end | ||
| end | ||
| @json_lib if Code.ensure_loaded?(JSON), do: JSON, else: Jason |
There was a problem hiding this comment.
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.
| @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.
There was a problem hiding this comment.
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.
34701cd to
d699d07
Compare
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.