Choose descriptive, specific names that clearly communicate intent and behavior rather than generic or ambiguous alternatives. Names should be self-documenting and reduce the need for additional context or comments.
Choose descriptive, specific names that clearly communicate intent and behavior rather than generic or ambiguous alternatives. Names should be self-documenting and reduce the need for additional context or comments.
Key principles:
start_with?('_misskey') instead of broad start_with?('_') when the intent is specific to Misskey propertiesby_language_length instead of by_language when sorting by length, or forwardable? instead of can_forward? to follow Ruby predicate conventionscategory_account instead of account for scopes to avoid confusion with model attributesoptions = {} with explicit forward_to_domains = [] to clarify expected usagelast_page? and paginating_down?Example:
# Avoid generic/ambiguous names
scope :account, -> { where(category: 'account') }
def can_forward?
# Use descriptive, specific names
scope :category_account, -> { where(category: 'account') }
def forwardable?
This approach improves code readability, reduces cognitive load, and makes the codebase more maintainable by ensuring names accurately reflect their purpose and behavior.
Enter the URL of a public GitHub repository