Skip to content

Conversation

@dharshan-kumarj
Copy link

Description

This PR addresses issue #2648 by adding detailed docstrings to all property methods in the Mixin classes across the GitHub, OWASP, and Mentorship apps.

As requested, each docstring now includes:

  • A description of the property's purpose.
  • A Returns section specifying the return type and a brief explanation of the returned value.

Files Updated

  • backend/apps/github/models/mixins/ (5 files)
  • backend/apps/owasp/models/mixins/ (4 files)
  • backend/apps/mentorship/models/mixins/ (1 file)

Reference

Fixes #2648

Copilot AI review requested due to automatic review settings December 21, 2025 10:57
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • Documentation

    • Expanded and clarified docstrings and return-value descriptions across many indexing-related properties for clearer API docs.
  • Bug Fixes & Improvements

    • Tightened indexability criteria for repositories, users, and chapters to better control what gets indexed.
    • Corrected subscribers count to return the actual subscriber value.
  • Refactor

    • Project accessors for top contributors and repositories are now callable methods (API shape adjusted).

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Expanded and clarified docstrings across many mixin properties (github, owasp, mentorship). Minor indexing predicate logic changed in repository, user, and chapter. ProjectIndexMixin.idx_repositories and idx_top_contributors converted from properties to methods with documented return shapes.

Changes

Cohort / File(s) Summary
GitHub — docstring-only mixins
backend/apps/github/models/mixins/issue.py, backend/apps/github/models/mixins/release.py, backend/apps/github/models/mixins/organization.py
Expanded and clarified docstrings for index-related properties (is_indexable, idx_*) with explicit Returns sections and type descriptions. No signature or logic changes.
GitHub — indexability & small logic changes
backend/apps/github/models/mixins/repository.py, backend/apps/github/models/mixins/user.py
repository.is_indexable now gates on not is_template and project membership; user.is_indexable adds runtime check against get_non_indexable_logins(). Many idx_* docstrings expanded; one behavioral predicate change in each file.
OWASP — docstring-only mixins
backend/apps/owasp/models/mixins/committee.py, backend/apps/owasp/models/mixins/common.py, backend/apps/owasp/models/mixins/...
Expanded docstrings for numerous index properties (is_indexable, idx_*) across OWASP mixins; no behavior or signature changes.
OWASP — indexability & API-shape changes
backend/apps/owasp/models/mixins/chapter.py, backend/apps/owasp/models/mixins/project.py
chapter.is_indexable adds requirements for latitude, longitude, and non-empty owasp_repository. ProjectIndexMixin.idx_repositories and idx_top_contributors changed from @property to plain methods with explicit return type annotations and documented dict shapes.
Mentorship — docstring-only mixin
backend/apps/mentorship/models/mixins/program.py
Expanded docstrings for program index properties (is_indexable, idx_*) without changing logic or signatures.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas that may require extra attention:
    • backend/apps/github/models/mixins/repository.py — verify intent of not is_template and project membership gating for indexing.
    • backend/apps/github/models/mixins/user.py — confirm behavior and potential side effects of consulting get_non_indexable_logins() at runtime.
    • backend/apps/owasp/models/mixins/chapter.py — validate the geo-location + owasp_repository requirement against downstream consumers.
    • backend/apps/owasp/models/mixins/project.py — ensure callers handle idx_repositories and idx_top_contributors now being methods and accept the documented dict shapes.

Possibly related PRs

Suggested reviewers

  • arkid15r
  • kasya

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Multiple code logic changes were introduced beyond documentation: idx_subscribers_count bug fix, is_indexable gating logic changes, and property-to-method conversions that violate issue scope. Remove logic changes from the PR and keep only documentation updates. Address the idx_subscribers_count bug and API signature changes in separate focused PRs.
Out of Scope Changes check ⚠️ Warning PR contains out-of-scope code changes including logic modifications (is_indexable conditions in repository.py), bug fixes (idx_subscribers_count), and API signature changes (property→method conversions in project.py). Remove all functional code changes and limit modifications to docstring additions only. Address logic and API changes in separate PRs focused on their specific concerns.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly describes the main change: adding detailed docstrings to property methods in Mixin classes across multiple apps.
Description check ✅ Passed Description is directly related to the changeset, explaining the purpose, files updated, and issue reference.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0418f72 and 0eb611d.

📒 Files selected for processing (1)
  • backend/apps/owasp/models/mixins/project.py (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-06T06:57:42.144Z
Learnt from: yashgoyal0110
Repo: OWASP/Nest PR: 0
File: :0-0
Timestamp: 2025-04-06T06:57:42.144Z
Learning: In the OWASP/Nest project, type annotations have been added to Python functions using the -> notation to specify return types (e.g., -> None, -> str) and parameter typing.

Applied to files:

  • backend/apps/owasp/models/mixins/project.py
🔇 Additional comments (1)
backend/apps/owasp/models/mixins/project.py (1)

5-225: LGTM! Excellent documentation improvements.

All property methods now have comprehensive, accurate docstrings that follow a consistent format. The type hints are precise (using list[dict[str, Any]] where appropriate), and all previously flagged issues have been addressed:

  • Space-separated vs comma-separated descriptions corrected
  • Health score conditional logic accurately documented
  • Updated timestamp return behavior clarified
  • Generic list types refined to list[dict[str, Any]]

The Any import is properly added to support the type hints. No logic changes detected—this is purely a documentation enhancement that significantly improves code maintainability.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive docstrings to property methods across Mixin classes in the GitHub, OWASP, and Mentorship apps. Each docstring now includes a description of the property's purpose and a Returns section specifying the return type and explanation.

Key Changes:

  • Enhanced all property method docstrings to include detailed descriptions and return type documentation
  • Fixed several pre-existing typos and incorrect descriptions in the original docstrings
  • Standardized docstring format across all mixin classes with consistent structure

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
backend/apps/owasp/models/mixins/project.py Added detailed docstrings to 20 property methods for project indexing, including descriptions and return types
backend/apps/owasp/models/mixins/common.py Enhanced 9 property methods with comprehensive docstrings for repository-based entity indexing
backend/apps/owasp/models/mixins/committee.py Added detailed documentation to 5 property methods for committee indexing
backend/apps/owasp/models/mixins/chapter.py Documented 13 property methods for chapter indexing with detailed return information
backend/apps/mentorship/models/mixins/program.py Enhanced 8 property methods with comprehensive docstrings for program indexing
backend/apps/github/models/mixins/user.py Added detailed docstrings to 24 property methods for user profile indexing
backend/apps/github/models/mixins/repository.py Documented 16 property methods for repository indexing with return type specifications
backend/apps/github/models/mixins/release.py Enhanced 10 property methods with detailed docstrings for release indexing
backend/apps/github/models/mixins/organization.py Added comprehensive documentation to 10 property methods for organization indexing
backend/apps/github/models/mixins/issue.py Documented 24 property methods for issue indexing, fixing several pre-existing typos

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""Return the health score for indexing.
Returns:
float | None: The project health score, or a default score if in production.
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring describes this as returning "The project health score, or a default score if in production." However, this is misleading because the function returns DEFAULT_HEALTH_SCORE when IS_PRODUCTION_ENVIRONMENT is True, not when it's in production generally. The description should clarify when the default is used versus when the actual health score is returned.

Suggested change
float | None: The project health score, or a default score if in production.
float | None: The project health score, or ``DEFAULT_HEALTH_SCORE`` when
``settings.IS_PRODUCTION_ENVIRONMENT`` is True.

Copilot uses AI. Check for mistakes.
"""Return the updated at timestamp for indexing.
Returns:
str | float: The last update timestamp, or an empty string.
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description states "The last update timestamp, or an empty string" which is accurate. However, the return type annotation shows "str | float", suggesting it could return a float. The actual implementation returns a float (from timestamp()) when updated_at exists, or an empty string otherwise. The description should clarify that it returns a timestamp as a float when available.

Suggested change
str | float: The last update timestamp, or an empty string.
str | float: The last update timestamp as a float when available,
or an empty string otherwise.

Copilot uses AI. Check for mistakes.
Returns:
int: The number of subscribers to the repository.
"""
return self.stars_count
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring states this returns "The number of subscribers to the repository", but the implementation actually returns self.stars_count instead of self.subscribers_count. This appears to be a pre-existing bug in the code. The docstring should either match the actual implementation (document that it returns stars_count), or the implementation should be fixed to return self.subscribers_count as the docstring suggests.

Suggested change
return self.stars_count
return self.subscribers_count

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
backend/apps/github/models/mixins/issue.py (1)

11-240: Add blank lines after "Returns" sections in all docstrings.

All property docstrings are missing a blank line after the "Returns" section, violating PEP 257 style guidelines (Ruff D413). This will likely cause linting failures.

🔎 Example fix for the first few properties
     def is_indexable(self):
         """Determine if the issue is indexable.
 
         Returns:
             bool: True if the issue is indexable, False otherwise.
+
         """
         return (
 
     @property
     def idx_author_login(self) -> str:
         """Return the author login for indexing.
 
         Returns:
             str: The login name of the issue author.
+
         """
         return self.author.login if self.author else ""

Apply this pattern to all 25 properties in this file.

backend/apps/github/models/mixins/release.py (1)

14-111: Add blank lines after "Returns" sections in all docstrings.

All property docstrings are missing a blank line after the "Returns" section (Ruff D413). Apply the same fix pattern to all 10 properties in this file.

backend/apps/github/models/mixins/repository.py (1)

16-189: Add blank lines after "Returns" sections in all docstrings.

All property docstrings are missing a blank line after the "Returns" section (Ruff D413). Apply the same fix pattern to all 19 properties in this file.

backend/apps/github/models/mixins/user.py (1)

14-281: Add blank lines after "Returns" sections in all docstrings.

All property docstrings are missing a blank line after the "Returns" section (Ruff D413). Apply the same fix pattern to all 23 properties in this file.

backend/apps/owasp/models/mixins/chapter.py (1)

13-131: Add blank lines after "Returns" sections in all docstrings.

All property docstrings are missing a blank line after the "Returns" section (Ruff D413). Apply the same fix pattern to all 13 properties in this file.

backend/apps/owasp/models/mixins/project.py (1)

22-202: Add blank line after Returns section in all docstrings.

All docstrings in this file are missing a blank line after the "Returns" section, violating the D413 style rule. Add a blank line after each Returns section to comply with the docstring format convention.

🔎 Example fix for idx_companies
     @property
     def idx_companies(self) -> str:
         """Return the companies for indexing.
 
         Returns:
             str: A joined string of unique company names from all member organizations.
+
         """
         return join_values(fields=[o.company for o in self.organizations.all()])

Apply this pattern to all other property docstrings in the file.

backend/apps/github/models/mixins/organization.py (1)

11-121: Add blank line after Returns section in all docstrings.

All docstrings in this file are missing a blank line after the "Returns" section, violating the D413 style rule. Add a blank line after each Returns section to comply with the docstring format convention.

🔎 Example fix for is_indexable
     @property
     def is_indexable(self) -> bool:
         """Determine if the organization is indexable.
 
         Returns:
             bool: True if it's an OWASP-related organization with a name and login, False otherwise.
+
         """
         return bool(self.is_owasp_related_organization and self.name and self.login)

Apply this pattern to all other property docstrings in the file.

🧹 Nitpick comments (1)
backend/apps/owasp/models/mixins/project.py (1)

122-127: Consider clarifying the key transformation logic.

The docstring describes the fallback as "a capitalized version of the key," but the implementation performs multiple transformations: removing the "www-project-" prefix, splitting on hyphens, capitalizing the first word, and joining with spaces. Consider updating the description to be more precise, such as "a human-readable name derived from the key."

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a2dc6a and bdb8e5d.

📒 Files selected for processing (10)
  • backend/apps/github/models/mixins/issue.py (2 hunks)
  • backend/apps/github/models/mixins/organization.py (2 hunks)
  • backend/apps/github/models/mixins/release.py (2 hunks)
  • backend/apps/github/models/mixins/repository.py (2 hunks)
  • backend/apps/github/models/mixins/user.py (5 hunks)
  • backend/apps/mentorship/models/mixins/program.py (1 hunks)
  • backend/apps/owasp/models/mixins/chapter.py (2 hunks)
  • backend/apps/owasp/models/mixins/committee.py (1 hunks)
  • backend/apps/owasp/models/mixins/common.py (1 hunks)
  • backend/apps/owasp/models/mixins/project.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
backend/apps/owasp/models/mixins/committee.py (7)
backend/apps/github/models/mixins/repository.py (2)
  • idx_key (84-90)
  • idx_top_contributors (174-180)
backend/apps/github/models/mixins/user.py (2)
  • idx_key (81-87)
  • idx_updated_at (266-272)
backend/apps/mentorship/models/mixins/program.py (1)
  • idx_key (28-34)
backend/apps/owasp/models/mixins/chapter.py (4)
  • idx_key (62-68)
  • idx_related_urls (98-104)
  • idx_top_contributors (116-122)
  • idx_updated_at (125-131)
backend/apps/owasp/models/mixins/project.py (3)
  • idx_key (85-91)
  • idx_top_contributors (179-185)
  • idx_updated_at (197-203)
backend/apps/owasp/api/internal/queries/committee.py (1)
  • committee (14-28)
backend/apps/github/models/mixins/issue.py (1)
  • idx_updated_at (225-231)
backend/apps/mentorship/models/mixins/program.py (6)
backend/apps/mentorship/models/program.py (1)
  • ProgramStatus (25-28)
backend/apps/github/models/mixins/repository.py (3)
  • idx_name (111-117)
  • idx_key (84-90)
  • idx_description (57-63)
backend/apps/github/models/mixins/user.py (2)
  • idx_name (126-132)
  • idx_key (81-87)
backend/apps/owasp/models/mixins/common.py (2)
  • idx_name (35-41)
  • idx_description (17-23)
backend/apps/owasp/models/mixins/chapter.py (1)
  • idx_key (62-68)
backend/apps/owasp/models/mixins/committee.py (1)
  • idx_key (22-28)
backend/apps/owasp/models/mixins/common.py (7)
backend/apps/github/models/mixins/organization.py (3)
  • idx_description (62-68)
  • idx_name (98-104)
  • idx_url (116-122)
backend/apps/github/models/mixins/release.py (2)
  • idx_description (51-57)
  • idx_name (69-75)
backend/apps/github/models/mixins/repository.py (3)
  • idx_description (57-63)
  • idx_name (111-117)
  • idx_topics (183-189)
backend/apps/mentorship/models/mixins/program.py (2)
  • idx_description (46-52)
  • idx_name (19-25)
backend/apps/github/models/mixins/user.py (2)
  • idx_name (126-132)
  • idx_url (275-281)
backend/apps/owasp/models/mixins/project.py (1)
  • idx_name (121-127)
backend/apps/github/models/mixins/issue.py (2)
  • idx_summary (198-204)
  • idx_url (234-240)
backend/apps/github/models/mixins/organization.py (2)
backend/apps/github/models/mixins/user.py (7)
  • idx_avatar_url (27-33)
  • idx_followers_count (90-96)
  • idx_location (108-114)
  • idx_login (117-123)
  • idx_name (126-132)
  • idx_public_repositories_count (135-141)
  • idx_url (275-281)
backend/apps/github/models/mixins/repository.py (2)
  • idx_description (57-63)
  • idx_name (111-117)
🪛 Ruff (0.14.8)
backend/apps/github/models/mixins/issue.py

13-13: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


30-30: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


39-39: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


48-48: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


57-57: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


66-66: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


75-75: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


84-84: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


93-93: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


102-102: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


111-111: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


120-120: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


129-129: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


138-138: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


147-147: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


156-156: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


165-165: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


174-174: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


183-183: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


192-192: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


201-201: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


210-210: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


219-219: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


228-228: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


237-237: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/repository.py

19-19: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


33-33: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


42-42: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


51-51: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


60-60: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


69-69: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


78-78: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


87-87: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


96-96: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


105-105: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


114-114: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


123-123: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


132-132: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


141-141: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


150-150: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


159-159: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


168-168: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


177-177: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


186-186: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/user.py

17-17: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


30-30: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


39-39: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


48-48: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


57-57: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


66-66: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


75-75: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


84-84: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


93-93: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


102-102: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


111-111: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


120-120: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


129-129: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


138-138: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


147-147: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


156-156: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


192-192: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


201-201: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


226-226: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


235-235: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


260-260: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


269-269: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


278-278: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/committee.py

16-16: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


25-25: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


34-34: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


43-43: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


52-52: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/mentorship/models/mixins/program.py

13-13: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


22-22: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


31-31: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


40-40: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


49-49: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


58-58: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


67-67: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


76-76: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/chapter.py

16-16: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


29-29: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


38-38: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


47-47: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


56-56: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


65-65: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


74-74: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


83-83: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


92-92: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


101-101: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


110-110: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


119-119: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


128-128: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/release.py

17-17: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


26-26: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


45-45: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


54-54: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


63-63: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


72-72: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


81-81: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


90-90: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


99-99: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


108-108: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/common.py

11-11: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


20-20: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


29-29: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


38-38: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


47-47: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


56-56: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


65-65: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


74-74: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/organization.py

13-13: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


22-22: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


34-34: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


56-56: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


65-65: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


74-74: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


83-83: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


92-92: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


101-101: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


110-110: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


119-119: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/project.py

24-24: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


33-33: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


42-42: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


51-51: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


60-60: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


70-70: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


79-79: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


88-88: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


97-97: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


106-106: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


115-115: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


124-124: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


133-133: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


142-142: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


164-164: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


173-173: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


182-182: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


191-191: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


200-200: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL analysis (python)
  • GitHub Check: Agent
🔇 Additional comments (5)
backend/apps/github/models/mixins/user.py (2)

152-186: Approve enhanced contribution data structure.

The idx_contributions property now includes:

  • Additional repository_contributors_count field for better context
  • Filtering to exclude forks and non-OWASP organizations
  • Query optimization with select_related("repository")

These improvements enhance data quality and query performance.


14-24: The get_non_indexable_logins() method is properly implemented.

Verified that the method exists in backend/apps/github/models/user.py as a static method that returns a set containing GitHub special accounts (actions, ghost user, foundation login) and all registered organization logins via Organization.get_logins(). The implementation is sound and the return type (set) correctly supports the membership check in is_indexable().

backend/apps/github/models/mixins/repository.py (1)

16-27: The new indexability conditions are properly tested and integrated. Test coverage includes all scenarios for the new is_template and project_set.exists() requirements. Downstream code in the Issue model correctly depends on repository.is_indexable, and sitemap views properly filter by this property. No conflicts or gaps identified.

backend/apps/owasp/models/mixins/chapter.py (1)

13-23: Approve enhanced chapter indexability check.

The is_indexable property now requires the owasp_repository to not be empty, which prevents indexing chapters without repository content. This is a sensible addition that aligns with the Repository model's is_empty BooleanField and is consistently applied in the chapter manager's query filters.

backend/apps/github/models/mixins/organization.py (1)

11-121: Excellent documentation additions.

The docstrings are well-written, accurately describe each property's behavior, and include appropriate return type information. The detailed explanation for idx_collaborators_count is particularly helpful given its more complex logic.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

♻️ Duplicate comments (3)
backend/apps/owasp/models/mixins/project.py (2)

56-64: Clarify when the default health score is returned.

The docstring states "or a default score if in production," which is ambiguous. The implementation returns DEFAULT_HEALTH_SCORE specifically when settings.IS_PRODUCTION_ENVIRONMENT is True, not just any production context.

🔎 Proposed fix (as suggested in past review)
         """Return the health score for indexing.
 
         Returns:
-            float | None: The project health score, or a default score if in production.
+            float | None: The project health score, or ``DEFAULT_HEALTH_SCORE`` when
+                ``settings.IS_PRODUCTION_ENVIRONMENT`` is True.
         """

193-200: Clarify that the timestamp is returned as a float.

The docstring mentions "timestamp" but doesn't explicitly state it's returned as a float. The return type is str | float, and the implementation returns .timestamp() (float) when available or an empty string otherwise.

🔎 Proposed fix (as suggested in past review)
         """Return the updated at timestamp for indexing.
 
         Returns:
-            str | float: The last update timestamp, or an empty string.
+            str | float: The last update timestamp as a float when available,
+                or an empty string otherwise.
         """
backend/apps/github/models/mixins/repository.py (1)

162-169: Pre-existing bug: idx_subscribers_count returns stars_count.

Line 169 returns self.stars_count instead of self.subscribers_count. This bug was already identified in previous reviews and remains unfixed.

🔎 Proposed fix
     @property
     def idx_subscribers_count(self) -> int:
         """Return the subscribers count for indexing.
 
         Returns:
             int: The number of subscribers to the repository.
         """
-        return self.stars_count
+        return self.subscribers_count
🧹 Nitpick comments (3)
backend/apps/owasp/models/mixins/project.py (1)

20-200: Add blank lines after the "Returns" section in all docstrings.

All property docstrings are missing a blank line after the "Returns" section, as flagged by Ruff (D413). This affects readability and violates PEP 257 conventions.

🔎 Example fix pattern

Apply this pattern to all 19 property methods:

     @property
     def idx_companies(self) -> str:
         """Return the companies for indexing.
 
         Returns:
             str: A joined string of unique company names from all member organizations.
+
         """
         return join_values(fields=[o.company for o in self.organizations.all()])
backend/apps/github/models/mixins/user.py (1)

15-265: Add blank lines after Returns sections in all docstrings.

All docstrings in this file are missing a blank line after the "Returns" section, which violates PEP 257 convention (Ruff D413). While this doesn't affect functionality, it impacts code style consistency.

Example fix for one property
     @property
     def idx_avatar_url(self) -> str:
         """Return the avatar URL for indexing.
 
         Returns:
             str: The URL of the user's avatar.
+
         """
         return self.avatar_url

Apply this pattern to all 23 properties in the file.

As per static analysis hints from Ruff.

backend/apps/github/models/mixins/repository.py (1)

17-187: Add blank lines after Returns sections in all docstrings.

All docstrings in this file are missing a blank line after the "Returns" section, which violates PEP 257 convention (Ruff D413). While this doesn't affect functionality, it impacts code style consistency.

Example fix for one property
     @property
     def idx_commits_count(self) -> int:
         """Return the commits count for indexing.
 
         Returns:
             int: The total number of commits in the repository.
+
         """
         return self.commits_count

Apply this pattern to all 19 properties in the file.

As per static analysis hints from Ruff.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bdb8e5d and dfcc525.

📒 Files selected for processing (4)
  • backend/apps/github/models/mixins/repository.py (1 hunks)
  • backend/apps/github/models/mixins/user.py (3 hunks)
  • backend/apps/owasp/models/mixins/chapter.py (1 hunks)
  • backend/apps/owasp/models/mixins/project.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
backend/apps/github/models/mixins/user.py (4)
backend/apps/github/models/mixins/organization.py (8)
  • idx_avatar_url (19-25)
  • idx_created_at (53-59)
  • idx_followers_count (71-77)
  • idx_location (80-86)
  • idx_login (89-95)
  • idx_name (98-104)
  • idx_public_repositories_count (107-113)
  • idx_url (116-122)
backend/apps/github/models/mixins/repository.py (3)
  • idx_created_at (46-52)
  • idx_key (82-88)
  • idx_name (109-115)
backend/apps/github/models/mixins/issue.py (4)
  • idx_created_at (54-60)
  • idx_title (207-213)
  • idx_updated_at (225-231)
  • idx_url (234-240)
backend/apps/github/models/common.py (1)
  • title (40-44)
backend/apps/owasp/models/mixins/project.py (4)
backend/apps/common/utils.py (1)
  • join_values (127-138)
backend/apps/github/models/mixins/repository.py (7)
  • idx_contributors_count (37-43)
  • idx_forks_count (64-70)
  • idx_key (82-88)
  • idx_languages (91-97)
  • idx_name (109-115)
  • idx_stars_count (154-160)
  • idx_top_contributors (172-178)
backend/apps/github/models/mixins/user.py (4)
  • idx_issues_count (207-213)
  • idx_key (77-83)
  • idx_name (122-128)
  • idx_updated_at (250-256)
backend/apps/owasp/models/mixins/committee.py (3)
  • idx_key (22-28)
  • idx_top_contributors (40-46)
  • idx_updated_at (49-55)
🪛 Ruff (0.14.8)
backend/apps/github/models/mixins/user.py

17-17: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


26-26: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


35-35: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


44-44: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


53-53: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


62-62: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


71-71: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


80-80: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


89-89: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


98-98: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


107-107: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


116-116: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


125-125: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


134-134: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


143-143: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


152-152: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


176-176: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


185-185: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


210-210: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


219-219: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


244-244: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


253-253: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


262-262: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/repository.py

19-19: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


31-31: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


40-40: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


49-49: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


58-58: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


67-67: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


76-76: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


85-85: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


94-94: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


103-103: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


112-112: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


121-121: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


130-130: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


139-139: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


148-148: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


157-157: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


166-166: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


175-175: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


184-184: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/chapter.py

16-16: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


28-28: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


37-37: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


46-46: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


55-55: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


64-64: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


73-73: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


82-82: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


91-91: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


100-100: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


109-109: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


118-118: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


127-127: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/project.py

24-24: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


33-33: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


42-42: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


51-51: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


60-60: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


70-70: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


79-79: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


88-88: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


97-97: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


106-106: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


115-115: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


124-124: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


133-133: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


142-142: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


161-161: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


170-170: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


179-179: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


188-188: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


197-197: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

🔇 Additional comments (2)
backend/apps/github/models/mixins/user.py (2)

68-74: Verify email indexing safeguards and compliance documentation.

Email is PII under GDPR/CCPA and requires documented safeguards when indexed. Ensure:

  • Access to the search index is restricted to authorized users only
  • Data encryption is implemented in transit and at rest
  • A lawful basis for processing (consent, contractual necessity, etc.) is documented
  • Retention policies are defined and enforced
  • Users are informed that email is indexed

If email indexing isn't essential for search functionality, consider excluding this field to minimize PII exposure.


149-170: The simplified data structure for idx_contributions is correct and requires no changes.

The review comment raises concerns about removed fields (repository_contributors_count, repository_forks_count, repository_latest_release, repository_license, repository_owner_key) and removed queryset exclusions (by_humans(), to_community_repositories()), but verification shows these were never part of the idx_contributions method:

  • None of these fields exist on the RepositoryContributor model in this context
  • No code in the codebase references or accesses these removed fields from contributions data
  • The by_humans() and to_community_repositories() filters exist in the manager but are not used in idx_contributions
  • The simplified structure mirrors other similar index methods (idx_issues, idx_releases), which follow the same pattern
  • No downstream consumers iterate over or access specific fields from the contributions list—the handlers simply pass the entire data structure to the index

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (6)
backend/apps/github/models/mixins/repository.py (1)

165-171: Critical bug: idx_subscribers_count returns stars_count instead of subscribers_count.

Line 171 incorrectly returns self.stars_count instead of self.subscribers_count. This appears to be a copy-paste error from the idx_stars_count property above it (lines 156-162). The docstring correctly states it should return "The number of subscribers to the repository", but the implementation doesn't match.

🔎 Proposed fix
     @property
     def idx_subscribers_count(self) -> int:
         """Return the subscribers count for indexing.
 
         Returns:
             int: The number of subscribers to the repository.
         """
-        return self.stars_count
+        return self.subscribers_count
backend/apps/owasp/models/mixins/chapter.py (1)

12-131: Blank lines after Returns sections still missing.

This issue was already flagged in the previous review. All docstrings in this file are missing a blank line after the "Returns" section, violating the D413 style rule.

backend/apps/owasp/models/mixins/project.py (4)

20-202: Blank lines after Returns sections still missing.

All docstrings are missing a blank line after the "Returns" section, violating the D413 style rule. This was already flagged in the previous review.


20-27: "Unique" claim in docstring remains unresolved.

The docstring still describes this as returning "unique company names" (line 25), but the implementation doesn't deduplicate. This issue was flagged in the previous review and hasn't been addressed.


178-185: Generic return type annotation remains unresolved.

The return type annotation is still list instead of the more precise list[dict[str, Any]]. This issue was flagged in the previous review, which verified that RepositoryContributor.get_top_contributors() returns a list of dictionaries.


56-64: Clarify when the default health score is returned.

The docstring says "or a default score if in production" (line 61), but the implementation returns DEFAULT_HEALTH_SCORE when settings.IS_PRODUCTION_ENVIRONMENT is True. This concern was raised in the previous review but hasn't been fully addressed—the condition should be stated more precisely.

🧹 Nitpick comments (2)
backend/apps/github/models/mixins/user.py (1)

15-281: Add blank lines after Returns sections in docstrings.

Static analysis indicates that all docstrings in this file are missing a blank line after the "Returns" section, which violates PEP 257 (D413). While this is a minor formatting issue, it should be addressed for consistency with the project's documentation standards.

🔎 Proposed fix script

Run this command to automatically fix the formatting across all docstrings:

#!/bin/bash
# Apply Ruff auto-fixes for D413 violations
cd backend && ruff check --select D413 --fix apps/github/models/mixins/user.py
backend/apps/github/models/mixins/repository.py (1)

17-189: Add blank lines after Returns sections in docstrings.

Static analysis indicates that all docstrings in this file are missing a blank line after the "Returns" section, which violates PEP 257 (D413). While this is a minor formatting issue, it should be addressed for consistency with the project's documentation standards.

🔎 Proposed fix script

Run this command to automatically fix the formatting across all docstrings:

#!/bin/bash
# Apply Ruff auto-fixes for D413 violations
cd backend && ruff check --select D413 --fix apps/github/models/mixins/repository.py
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfcc525 and 60c0bf5.

📒 Files selected for processing (4)
  • backend/apps/github/models/mixins/repository.py (2 hunks)
  • backend/apps/github/models/mixins/user.py (5 hunks)
  • backend/apps/owasp/models/mixins/chapter.py (2 hunks)
  • backend/apps/owasp/models/mixins/project.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-06T06:57:42.144Z
Learnt from: yashgoyal0110
Repo: OWASP/Nest PR: 0
File: :0-0
Timestamp: 2025-04-06T06:57:42.144Z
Learning: In the OWASP/Nest project, type annotations have been added to Python functions using the -> notation to specify return types (e.g., -> None, -> str) and parameter typing.

Applied to files:

  • backend/apps/owasp/models/mixins/project.py
🧬 Code graph analysis (4)
backend/apps/owasp/models/mixins/chapter.py (4)
backend/apps/mentorship/models/mixins/program.py (1)
  • idx_key (28-34)
backend/apps/owasp/api/internal/nodes/common.py (1)
  • related_urls (24-26)
backend/apps/owasp/api/internal/nodes/chapter.py (1)
  • suggested_location (54-56)
backend/apps/owasp/api/internal/queries/chapter.py (1)
  • chapter (14-19)
backend/apps/github/models/mixins/repository.py (4)
backend/apps/owasp/models/mixins/project.py (1)
  • idx_top_contributors (179-185)
backend/apps/owasp/api/internal/nodes/committee.py (1)
  • contributors_count (15-17)
backend/apps/owasp/models/mixins/committee.py (1)
  • idx_top_contributors (40-46)
backend/apps/github/models/repository.py (2)
  • nest_key (152-154)
  • project (162-164)
backend/apps/github/models/mixins/user.py (2)
backend/apps/github/models/mixins/repository.py (2)
  • idx_created_at (48-54)
  • idx_name (111-117)
backend/apps/github/models/mixins/issue.py (4)
  • idx_created_at (54-60)
  • idx_title (207-213)
  • idx_updated_at (225-231)
  • idx_url (234-240)
backend/apps/owasp/models/mixins/project.py (4)
backend/apps/common/utils.py (1)
  • join_values (127-138)
backend/apps/github/models/mixins/repository.py (3)
  • idx_contributors_count (39-45)
  • idx_name (111-117)
  • idx_top_contributors (174-180)
backend/apps/owasp/models/mixins/committee.py (1)
  • idx_top_contributors (40-46)
backend/apps/owasp/models/mixins/common.py (1)
  • idx_name (35-41)
🪛 Ruff (0.14.8)
backend/apps/owasp/models/mixins/chapter.py

16-16: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


29-29: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


38-38: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


47-47: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


56-56: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


65-65: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


74-74: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


83-83: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


92-92: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


101-101: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


110-110: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


119-119: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


128-128: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/repository.py

19-19: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


33-33: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


42-42: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


51-51: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


60-60: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


69-69: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


78-78: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


87-87: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


96-96: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


105-105: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


114-114: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


123-123: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


132-132: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


141-141: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


150-150: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


159-159: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


168-168: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


177-177: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


186-186: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/github/models/mixins/user.py

17-17: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


30-30: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


39-39: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


48-48: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


57-57: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


66-66: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


75-75: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


84-84: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


93-93: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


102-102: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


111-111: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


120-120: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


129-129: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


138-138: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


147-147: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


156-156: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


192-192: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


201-201: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


226-226: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


235-235: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


260-260: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


269-269: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


278-278: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

backend/apps/owasp/models/mixins/project.py

24-24: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


33-33: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


42-42: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


51-51: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


60-60: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


70-70: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


79-79: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


88-88: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


97-97: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


106-106: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


115-115: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


124-124: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


133-133: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


142-142: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


164-164: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


173-173: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


182-182: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


191-191: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)


200-200: Missing blank line after last section ("Returns")

Add blank line after "Returns"

(D413)

🔇 Additional comments (2)
backend/apps/github/models/mixins/user.py (1)

14-24: LGTM! The is_indexable implementation is now complete.

The property now correctly checks all three conditions:

  1. User is not a bot (not self.is_bot)
  2. Login doesn't end with bot suffixes (not self.login.endswith(("Bot", "-bot")))
  3. Login is not in the non-indexable logins list (self.login not in self.get_non_indexable_logins())

This addresses the past review comment and will pass the existing tests.

backend/apps/github/models/mixins/repository.py (1)

16-27: LGTM! The is_indexable implementation is now complete.

The property now correctly checks all four conditions:

  1. Repository is not archived (not self.is_archived)
  2. Repository is not empty (not self.is_empty)
  3. Repository is not a template (not self.is_template)
  4. Repository belongs to a project (self.project_set.exists())

This addresses the past review comment and aligns with test expectations.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
backend/apps/github/models/mixins/repository.py (1)

180-188: Critical bug: idx_subscribers_count returns stars_count instead of subscribers_count.

This is a copy-paste error from idx_stars_count above. The docstring correctly states "The number of subscribers to the repository", but the implementation returns self.stars_count instead of self.subscribers_count.

This bug was previously flagged in past reviews but remains unfixed.

🔎 Proposed fix
     @property
     def idx_subscribers_count(self) -> int:
         """Return subscribers count for indexing.
 
         Returns:
             int: The number of subscribers to the repository.
 
         """
-        return self.stars_count
+        return self.subscribers_count
🧹 Nitpick comments (1)
backend/apps/owasp/models/mixins/common.py (1)

8-85: Add type hints to property methods for consistency with similar files in the codebase.

The docstrings are well-formatted with appropriate blank lines and return type documentation. However, all properties lack type hints (→ annotations). Similar mixin files like repository.py consistently use type hints on all properties (e.g., -> bool, -> str, -> int). Add type hints to match this established pattern:

  • is_indexable() -> bool
  • idx_description() -> str
  • idx_leaders() -> list
  • idx_name() -> str
  • idx_summary() -> str
  • idx_tags() -> list
  • idx_topics() -> list
  • idx_url() -> str
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60c0bf5 and 0361b57.

📒 Files selected for processing (10)
  • backend/apps/github/models/mixins/issue.py (2 hunks)
  • backend/apps/github/models/mixins/organization.py (3 hunks)
  • backend/apps/github/models/mixins/release.py (2 hunks)
  • backend/apps/github/models/mixins/repository.py (2 hunks)
  • backend/apps/github/models/mixins/user.py (5 hunks)
  • backend/apps/mentorship/models/mixins/program.py (1 hunks)
  • backend/apps/owasp/models/mixins/chapter.py (2 hunks)
  • backend/apps/owasp/models/mixins/committee.py (1 hunks)
  • backend/apps/owasp/models/mixins/common.py (1 hunks)
  • backend/apps/owasp/models/mixins/project.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • backend/apps/owasp/models/mixins/chapter.py
  • backend/apps/owasp/models/mixins/committee.py
  • backend/apps/github/models/mixins/organization.py
  • backend/apps/github/models/mixins/release.py
  • backend/apps/owasp/models/mixins/project.py
🧰 Additional context used
🧬 Code graph analysis (3)
backend/apps/mentorship/models/mixins/program.py (1)
backend/apps/mentorship/models/program.py (1)
  • ProgramStatus (25-28)
backend/apps/owasp/models/mixins/common.py (6)
backend/apps/github/models/mixins/organization.py (3)
  • idx_description (66-73)
  • idx_name (106-113)
  • idx_url (126-133)
backend/apps/github/models/mixins/release.py (2)
  • idx_description (54-61)
  • idx_name (74-81)
backend/apps/github/models/mixins/repository.py (2)
  • idx_description (61-68)
  • idx_name (121-128)
backend/apps/mentorship/models/mixins/program.py (2)
  • idx_description (50-57)
  • idx_name (20-27)
backend/apps/owasp/models/mixins/project.py (1)
  • idx_name (132-139)
backend/apps/github/models/mixins/issue.py (2)
  • idx_summary (218-225)
  • idx_url (258-265)
backend/apps/github/models/mixins/repository.py (4)
backend/apps/owasp/models/mixins/project.py (1)
  • idx_key (92-99)
backend/apps/owasp/models/mixins/chapter.py (1)
  • idx_key (67-74)
backend/apps/github/models/repository.py (2)
  • nest_key (152-154)
  • project (162-164)
backend/apps/github/models/repository_contributor.py (1)
  • get_top_contributors (119-201)
🔇 Additional comments (6)
backend/apps/mentorship/models/mixins/program.py (1)

10-87: LGTM! Docstrings are well-formatted and complete.

The docstrings for all properties have been properly updated with:

  • Clear descriptions of each property's purpose
  • Accurate type annotations matching the actual return values
  • Properly formatted Returns sections with blank lines (resolving the previous Ruff D413 linting issues)
  • Consistent formatting across all 8 properties

The documentation clearly explains the Algolia indexing purpose of each property, and the fallback behavior for optional fields (idx_description, idx_experience_levels, idx_started_at, idx_ended_at) is correctly reflected in the return type annotations.

backend/apps/github/models/mixins/issue.py (1)

10-265: LGTM! Excellent documentation improvements.

The docstrings are clear, consistent, and follow a standard format with explicit Returns sections. All property purposes are well-documented, making the codebase more maintainable.

backend/apps/github/models/mixins/user.py (2)

14-25: LGTM! Past issue successfully resolved.

The is_indexable implementation now correctly includes all necessary checks: bot detection, login suffix validation, and exclusion of non-indexable logins. The docstring clearly documents the behavior.


28-304: LGTM! Comprehensive documentation.

All property docstrings are well-written with clear descriptions and explicit return types. The documentation for complex structures (contributions, issues, releases) is particularly helpful.

backend/apps/github/models/mixins/repository.py (2)

16-28: LGTM! Past issue successfully resolved.

The is_indexable implementation now correctly includes all necessary checks: archived status, empty status, template status, and project association. The docstring clearly documents the behavior.


30-178: LGTM! Excellent documentation improvements.

All property docstrings (except idx_subscribers_count which has a bug) are clear, consistent, and follow a standard format with explicit Returns sections. The documentation significantly improves code maintainability.

Also applies to: 190-208

@dharshan-kumarj
Copy link
Author

Clarification on CodeRabbit Warnings

Logic Changes: The logic in these files (e.g., is_template checks in repository.py, login exclusions in user.py) matches the current OWASP/Nest:main branch exactly. These logic elements existed in upstream before this PR. This PR only adds docstrings.

idx_subscribers_count Bug: The bug where it returns stars_count instead of subscribers_count exists in the upstream code. This should be addressed in a separate bug-fix PR to keep this PR focused on documentation only.

Summary: This is a pure documentation PR adding detailed docstrings to 10 mixin files as requested in #2648.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (3)
backend/apps/owasp/models/mixins/project.py (3)

214-222: Clarify that the timestamp is returned as a float value.

The docstring states "last update timestamp, or empty string" but doesn't make it clear that the timestamp is returned as a float (from .timestamp()). A previous review comment suggested clarifying this for better documentation.

🔎 Proposed fix
-        """Return updated at timestamp for indexing.
-
-        Returns:
-            str | float: The project's last update timestamp, or empty string.
-
-        """
+        """Return updated at timestamp for indexing.
+
+        Returns:
+            str | float: The project's last update timestamp as a float, or empty string if not available.
+
+        """

194-202: Use more specific type annotation as flagged in previous review.

The return type list[dict] is too generic. A previous review comment noted that RepositoryContributor.get_top_contributors returns a list of dictionaries with specific keys (avatar_url, contributions_count, login, name), and the equivalent property in backend/apps/github/models/mixins/repository.py (line 190) uses list[dict[str, Any]] for consistency.

🔎 Proposed fix

Add the import at the top of the file:

from typing import Any

Then update the type annotation:

     @property
-    def idx_top_contributors(self) -> list[dict]:
+    def idx_top_contributors(self) -> list[dict[str, Any]]:
         """Return top contributors for indexing.

60-69: Clarify the production environment condition in the docstring.

The docstring states "DEFAULT_HEALTH_SCORE when in production" which is imprecise. The code specifically checks settings.IS_PRODUCTION_ENVIRONMENT, which should be explicitly mentioned for accuracy.

🔎 Proposed fix
-        """Return health score for indexing.
-
-        Returns:
-            float | None: DEFAULT_HEALTH_SCORE when in production, otherwise the actual health score.
-
-        """
+        """Return health score for indexing.
+
+        Returns:
+            float | None: DEFAULT_HEALTH_SCORE when IS_PRODUCTION_ENVIRONMENT is True, otherwise the actual health score.
+
+        """
🧹 Nitpick comments (1)
backend/apps/owasp/models/mixins/project.py (1)

151-172: Consider using more specific type annotation for consistency.

The return type list[dict] is generic. For consistency with similar properties in the codebase (e.g., repository.idx_top_contributors uses list[dict[str, Any]]), consider being more specific about the dictionary contents.

🔎 Proposed type annotation improvement

Add the import at the top of the file:

from typing import Any

Then update the type annotation:

     @property
-    def idx_repositories(self) -> list[dict]:
+    def idx_repositories(self) -> list[dict[str, Any]]:
         """Return repositories for indexing.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0361b57 and 9827193.

📒 Files selected for processing (1)
  • backend/apps/owasp/models/mixins/project.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-06T06:57:42.144Z
Learnt from: yashgoyal0110
Repo: OWASP/Nest PR: 0
File: :0-0
Timestamp: 2025-04-06T06:57:42.144Z
Learning: In the OWASP/Nest project, type annotations have been added to Python functions using the -> notation to specify return types (e.g., -> None, -> str) and parameter typing.

Applied to files:

  • backend/apps/owasp/models/mixins/project.py
🧬 Code graph analysis (1)
backend/apps/owasp/models/mixins/project.py (3)
backend/apps/common/utils.py (1)
  • join_values (127-138)
backend/apps/github/models/mixins/repository.py (6)
  • idx_contributors_count (41-48)
  • idx_forks_count (71-78)
  • idx_languages (101-108)
  • idx_name (121-128)
  • idx_stars_count (171-178)
  • idx_top_contributors (191-198)
backend/apps/github/models/repository_contributor.py (2)
  • RepositoryContributor (18-201)
  • get_top_contributors (119-201)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
backend/apps/owasp/models/mixins/project.py (1)

218-224: Consider clarifying the float return type in the description.

The docstring could be slightly more precise by stating that the timestamp is returned as a float value when available: "The project's last update timestamp as a float, or an empty string if unavailable."

🔎 Suggested refinement
         """Return updated at timestamp for indexing.

         Returns:
-            str | float: The project's last update timestamp, or empty string.
+            str | float: The project's last update timestamp as a float, or an empty string if unavailable.

         """
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9827193 and 0418f72.

📒 Files selected for processing (2)
  • backend/apps/github/models/mixins/repository.py (2 hunks)
  • backend/apps/owasp/models/mixins/project.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/apps/github/models/mixins/repository.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-06T06:57:42.144Z
Learnt from: yashgoyal0110
Repo: OWASP/Nest PR: 0
File: :0-0
Timestamp: 2025-04-06T06:57:42.144Z
Learning: In the OWASP/Nest project, type annotations have been added to Python functions using the -> notation to specify return types (e.g., -> None, -> str) and parameter typing.

Applied to files:

  • backend/apps/owasp/models/mixins/project.py
🔇 Additional comments (6)
backend/apps/owasp/models/mixins/project.py (6)

154-155: AI summary incorrectly describes these as method conversions.

The AI summary claims idx_repositories and idx_top_contributors were "converted from properties to methods (callable)," but both retain their @property decorators. Only the type hints were added to the signatures; they remain properties, not plain callable methods.

Also applies to: 197-198


5-5: LGTM: Import needed for type hints.

The Any import is correctly added to support the list[dict[str, Any]] return type annotations for idx_repositories and idx_top_contributors.


22-30: LGTM: "Space-separated" correction applied.

Both idx_companies and idx_organizations docstrings now correctly state "space-separated" instead of the previously flagged "comma-separated," matching the default behavior of join_values.

Also applies to: 144-152


63-72: LGTM: Health score behavior clearly documented.

The docstring now explicitly describes the conditional return of DEFAULT_HEALTH_SCORE when settings.IS_PRODUCTION_ENVIRONMENT is True, addressing the previous review feedback.


155-161: LGTM: Return types now properly specified.

Both idx_repositories and idx_top_contributors now use list[dict[str, Any]] return type annotations instead of the generic list, addressing previous review feedback. The docstrings accurately describe the returned structures.

Also applies to: 197-205


1-225: Excellent documentation work—all major review feedback addressed.

This PR successfully adds comprehensive docstrings to all idx_* properties, fixes the "comma-separated" vs. "space-separated" issues from previous reviews, and adds proper type hints (list[dict[str, Any]]) where needed. The documentation is consistent, accurate, and follows the repository's docstring style.

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 21, 2025
@sonarqubecloud
Copy link

@rudransh-shrivastava rudransh-shrivastava self-assigned this Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Docstrings to Model Mixin Methods

2 participants