Skip to content

Extract Magic Numbers to Named Constants #2649

@coderabbitai

Description

@coderabbitai

Description

Extract hardcoded numbers to named constants at module level to improve code readability and maintainability.

Estimated Effort

1 story point

Files

  • backend/apps/github/models/mixins/*.py
  • backend/apps/owasp/models/mixins/*.py

Task Details

Many methods in model mixins use magic numbers (hardcoded numeric values) that should be extracted to named constants for better code clarity and maintainability.

Example

# At module level
ISSUES_LIMIT = 6
RELEASES_LIMIT = 6
TOP_CONTRIBUTORS_LIMIT = 6

# In method
def get_top_contributors(self):
    return self.contributors[:TOP_CONTRIBUTORS_LIMIT]

Implementation Notes

  • Find all hardcoded numbers in the mixin files
  • Extract them to module-level constants with descriptive names
  • Replace the hardcoded values with the constants
  • Ensure tests still pass after the refactoring
  • Run make check-test locally before submitting

Getting Started

  1. Comment on this issue to indicate you'd like to work on it
  2. Review the contributing guidelines
  3. Create a feature branch and submit a PR when ready
  4. Reference this issue in your PR description

Related

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions