ruby-ldap/ruby-net-ldap — pull request #141 by mtodd (2014-10-22 04:38:50+00:00)
Title: Magic number/constant cleanup

Too many magic numbers and hardcoded everywhere. We need to extract these values into constants to make it easier to reason about the code and what's happening, and to help us ensure we're following the spec.

This PR mainly focuses on the result code, but I'm going to keep scanning for "magic numbers" and work on a strategy to replace them. So far:

- [x] include all codes from spec (https://tools.ietf.org/html/rfc4511#appendix-A)
- [x] create constants for reuse (a la `Net::LDAP::ResultCodeSuccess`)
- [x] define list of non-error result codes (https://tools.ietf.org/html/rfc4511#appendix-A.1)
- [x] replace usage of magic constants (`result_code == 0`)
- [x] define (non-standard) list of acceptable search result codes (including `sizeLimitExceeded`)

While the list of constants is big, it helps move the code towards a more maintainable state.

cc @jch @schaary