Skip to content

Instantly share code, notes, and snippets.

@fguillen
Created May 19, 2024 17:45
Show Gist options
  • Save fguillen/56464d4294cd07843ed3b30d8c1b7aff to your computer and use it in GitHub Desktop.
Save fguillen/56464d4294cd07843ed3b30d8c1b7aff to your computer and use it in GitHub Desktop.
Common Comment Tags in Ruby

Common Comment Tags in Ruby

In Ruby (and many other programming languages), developers use comment tags to annotate their code for various purposes. These tags help in identifying different types of comments, which can be particularly useful for maintaining and navigating large codebases. Here are some common comment tags you can use:

1. TODO

Indicates something that needs to be done in the future.

# TODO: Implement the authentication logic here

2. FIXME

Identifies a known bug in the code.

# FIXME: This method fails when input is nil

3. BUG

Identifies a known bug in the code.

# BUG: This calculation returns the wrong value for negative inputs

4. OPTIMIZE

Indicates a place where the code could be made more efficient.

# OPTIMIZE: This loop can be optimized for better performance

5. HACK

A workaround or temporary solution that needs to be revisited.

# HACK: Using a hardcoded value here until we get proper input

6. NOTE

Provides additional information or context about the code.

# NOTE: This method is only used in the admin panel

7. REVIEW

Marks code that should be reviewed, often used during code reviews.

# REVIEW: Ensure this logic covers all edge cases

8. DEPRECATED

Marks code that is outdated and should not be used in new development.

# DEPRECATED: Use the new authentication method instead

9. IMPORTANT

Highlights an important aspect of the code that should not be overlooked.

# IMPORTANT: This API call must be idempotent

10. SECURITY

Draws attention to security-related aspects of the code.

# SECURITY: Validate user input to prevent SQL injection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment