luckyframework / luckyframework/avram

Change validate_numeric arg names (again)

Open
#883 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

@paulcsmith had some good insight on this:

> What if we changed the name to exactly what it does using more "mathy" terms:

greater_than_or_equal_to
less_than_or_equal_to

> And I'm not sure there is an option, but may be worth adding a greater_than and less_than that actually use > and < similar to https://guides.rubyonrails.org/active_record_validations.html#numericality

> I think since these terms are fairly common and have a strictly defined meaning that may be more intuitive and accurate. It is more wordy for sure, but these types of validations typically aren't used that much, and if they are I think the wordiness is helpful to make sure it is accurate. What do you think?

Although I do like the shorter `at_least`, and `no_more_than`, I never considered non-english speakers could potentially find it confusing. Following an already used convention would at least give some clarity.

Along with the rename, then we also add back in the `greater_than` and `less_than` for the specific `>` and `<` cases.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the validate_numeric implementation and any tests or call sites that cover its argument names. Compare the existing options with the proposed greater_than_or_equal_to, less_than_or_equal_to, greater_than, and less_than names. Done means the renamed options and strict comparison cases are consistently supported without leaving the current validation behavior ambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.