The Wikipedia page for lattice has a definition of rank. Is this definition correct, or should rather the condition be r(y) >= r(x) + 1?
https://en.m.wikipedia.org/wiki/Lattice_(order)#Lattices_as_partially_ordered_sets
A lattice (L, ≤) is called graded, sometimes ranked (but see Ranked poset for an alternative meaning), if it can be equipped with a rank function r from L to ℕ, sometimes to ℤ, compatible with the ordering (so r(x) < r(y) whenever x < y) such that whenever y covers x, then r(y) = r(x) + 1.
I think the article is ok.
Notice the definition coincides with the one for posets, that is, the "rank is consistent with the covering relation", meaning that $$x \prec y \Longrightarrow \rho(y) = \rho(x)+1,$$ where $\rho$ is the ranking function.
Of course this means that not all lattices (and thus, not all posets) can be ranked.
For example the pentagon, $\mathbf N_5$, can't be ranked.