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

[in-review] Code optimisations via adding the credo #285

Merged

Conversation

imahmedismail
Copy link
Contributor

This PR involves the following changes:

  • Add credo to the project and:
    • Run mix credo --all to identify possible code optimizations
    • Resolve most of the errors generated by credo such as:
      • Numbers larger than 9999 should be written with underscores: 58_127
      • Modules should have a @moduledoc tag
      • Comparison will always return true

 - Run mix credo --all to identify possible code optimizations
 - Resolve most of the errors generated by credo such as:
   - Numbers larger than 9999 should be written with underscores: 58_127
   - Modules should have a @moduledoc tag
   - Comparison will always return true
@imahmedismail imahmedismail changed the title [in-review] Add credo to the project and: [in-review] Code optimisations via adding the credo Nov 9, 2023
Copy link
Collaborator

@iamvery iamvery left a comment

Choose a reason for hiding this comment

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

This all seems pretty reasonable to me, and I don't have any strong feelings against Credo. There is one place that I think is a mistake (see requested change).

@@ -19,7 +19,7 @@ defmodule BlanksTest do
end

test "multiple arguments" do
ast = quote do: assert(___ == ___)
ast = quote do: assert true == false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ast = quote do: assert true == false
ast = quote do: assert ___ == ___

Copy link
Contributor Author

@imahmedismail imahmedismail Nov 10, 2023

Choose a reason for hiding this comment

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

This is done.
cc: @iamvery

@iamvery
Copy link
Collaborator

iamvery commented Nov 10, 2023

I added configuration for credo to run in CI using --strict mode and fixed the suggestions it made. Thanks for the idea and getting this started!

@iamvery iamvery merged commit 0eb56c2 into elixirkoans:master Nov 10, 2023
1 check passed
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