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
Large number 1_000_000_00 show error #948
Comments
I have run in to the same issue - I think the specific issue is the trailing two digits for numbers that have more than 4 digits. for example:
using: |
This is correct and currently by design, but I can see how we would want to allow trailing digits for things like monetary use cases. I added a check parameter # exactly 2 digits
{Credo.Check.Readability.LargeNumbers, trailing_digits: 2},
# exactly 2 or 4 digits
{Credo.Check.Readability.LargeNumbers, trailing_digits: [2, 4]},
# 2, 3 or 4 digits
{Credo.Check.Readability.LargeNumbers, trailing_digits: 2..4}, You can try this by setting the Credo dep to {:credo, github: "rrrene/credo"} Please report back if your issue is solved! 👍 |
Can confirm that this resolved my issue. Thank you so much for the quick response! 🙌 |
Sorry for the delay rrrene, I confirm that this solves my problem perfectly 👍 . Thank you very much for the prompt reply 💨
Which includes this in the config file, which is perfect for setting up the credo revision. |
@nathanbegbie @Macorreag This is now live in |
Environment
mix credo -v
): 1.5.6-ref.v1.0.0691faf+uncommittedchangeselixir -v
): Elixir 1.10.4 (compiled with Erlang/OTP 21)What were you trying to do?
I'm using credo in a Phoenix project where the Money structure is used and it contains a long number that generates this error.
Error Generate By credo type Code rediability.
Expected outcome
I would not expect a creedal warning for this case, as the number is well written.
Actual outcome
Code rediability: Large numbers shold be written with underscores
The text was updated successfully, but these errors were encountered: