-
Notifications
You must be signed in to change notification settings - Fork 0
#162 - Add support of Issue type to IssueRecord #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#162 - Add support of Issue type to IssueRecord #163
Conversation
- Add issue type attribute.
WalkthroughAdds issue_type property to IssueRecord with initialization from issue.type.name. Updates DEVELOPER.md coverage instructions to include HTML report. Adds new tests for IssueRecord issue_type behavior, PullRequestRecord release notes parsing/commit retrieval, and removes an unused import in a test. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks (1 passed, 4 warnings)❌ Failed checks (4 warnings)
✅ Passed checks (1 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. ✨ Finishing Touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
DEVELOPER.md (1)
99-121
: Fix repeated “my[py]” typos to “mypy”.These appear multiple times in this section and are user-facing.
-This project uses the [my[py]](https://mypy.readthedocs.io/en/stable/) tool, a static type checker for Python. +This project uses the [mypy](https://mypy.readthedocs.io/en/stable/) tool, a static type checker for Python. @@ -my[py] configuration is in `pyproject.toml` file. +mypy configuration is in `pyproject.toml` file. @@ -Follow these steps to format your code with my[py] locally: +Follow these steps to run mypy locally: @@ -### Run my[py] +### Run mypy @@ -Run my[py] on all files in the project. +Run mypy on all files in the project. @@ -To run my[py] check on a specific file, follow the pattern `mypy <path_to_file>/<name_of_file>.py --check-untyped-defs`. +To run mypy on a specific file, use `mypy <path_to_file>/<name_of_file>.py --check-untyped-defs`.release_notes_generator/model/issue_record.py (1)
105-129
: Also parse release notes from the Issue body (not only linked PRs).PR objective mentions presence of Release Notes on issues; currently only PR bodies are parsed. Add Issue body parsing before iterating PRs.
from typing import Optional, Any +from typing import cast @@ # Code Rabbit detection regex cr_active: bool = ActionInputs.is_coderabbit_support_active() + # Check Issue body first + if self._issue.body: + if detection_regex.search(self._issue.body): + # reuse extractor; cast to satisfy type checker + release_notes += self._get_rls_notes_default(cast(Any, self._issue), line_marks, detection_regex) + elif cr_active: + cr_detection_regex: re.Pattern[Any] = re.compile(ActionInputs.get_coderabbit_release_notes_title()) + if cr_detection_regex.search(self._issue.body): + release_notes += self._get_rls_notes_code_rabbit( + cast(Any, self._issue), line_marks, cr_detection_regex + ) + # Iterate over all PRs for pull in self._pull_requests.values(): if pull.body and detection_regex.search(pull.body): release_notes += self._get_rls_notes_default(pull, line_marks, detection_regex) elif pull.body and cr_active: cr_detection_regex: re.Pattern[Any] = re.compile(ActionInputs.get_coderabbit_release_notes_title()) if cr_detection_regex.search(pull.body): release_notes += self._get_rls_notes_code_rabbit(pull, line_marks, cr_detection_regex)Would you like a companion unit test that covers Issue body extraction (both default and CodeRabbit formats)?
🧹 Nitpick comments (6)
DEVELOPER.md (2)
138-140
: Clarify that these are alternatives to avoid running tests twice.Add a hint line so readers pick one command, not both.
```shell -pytest --cov=. -v tests/ --cov-fail-under=80 # Check coverage threshold -pytest --cov=. -v tests/ --cov-fail-under=80 --cov-report=html # Generate HTML report +# Pick one of the following: +pytest --cov=. -v tests/ --cov-fail-under=80 # Check coverage threshold +pytest --cov=. -v tests/ --cov-fail-under=80 --cov-report=html # Generate HTML report--- `146-148`: **Make HTML report opening cross-platform.** “open” is macOS-specific; suggest a portable option. ```diff -open htmlcov/index.html +python -m webbrowser htmlcov/index.html # cross-platform +# or: xdg-open htmlcov/index.html # Linux +# or: start htmlcov\\index.html # Windows
release_notes_generator/model/issue_record.py (2)
70-78
: Docstring return type mismatch.Property returns Optional[str] but docstring says str.
@property def issue_type(self) -> Optional[str]: """ Gets the type of the issue. Returns: - str: The type of the issue. + Optional[str]: The type of the issue, or None if not set. """ return self._issue_type
255-260
: Fix param type in docstring.This helper accepts a PullRequest-like object with a body; current docstring mentions PullRequestRecord.
- Parameters: - pull (PullRequestRecord): The pull request from which to extract release notes. + Parameters: + pull (PullRequest): The pull request from which to extract release notes.tests/release_notes/model/test_pull_request_record.py (1)
49-49
: Silence S101 (“assert”) in tests via Ruff config (optional).If Ruff flags S101 in tests, configure per-file ignores in pyproject.
# pyproject.toml [tool.ruff] # ... [tool.ruff.per-file-ignores] "tests/**.py" = ["S101"]Also applies to: 56-57
tests/release_notes/model/test_issue_record.py (1)
25-44
: Helper is concise; consider freezing time (optional).created_at = datetime.now() isn’t asserted, but if needed later, prefer a fixed datetime for determinism.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
DEVELOPER.md
(1 hunks)release_notes_generator/model/issue_record.py
(2 hunks)tests/release_notes/model/test_issue_record.py
(1 hunks)tests/release_notes/model/test_pull_request_record.py
(1 hunks)tests/release_notes/test_record_factory.py
(0 hunks)
💤 Files with no reviewable changes (1)
- tests/release_notes/test_record_factory.py
🧰 Additional context used
🧬 Code graph analysis (2)
tests/release_notes/model/test_pull_request_record.py (2)
release_notes_generator/model/pull_request_record.py (1)
PullRequestRecord
(15-286)tests/conftest.py (1)
pull_request_record_merged
(479-482)
tests/release_notes/model/test_issue_record.py (1)
release_notes_generator/model/issue_record.py (3)
IssueRecord
(16-301)issue
(63-68)issue_type
(71-77)
🪛 Ruff (0.12.2)
tests/release_notes/model/test_pull_request_record.py
49-49: Use of assert
detected
(S101)
56-56: Use of assert
detected
(S101)
57-57: Use of assert
detected
(S101)
tests/release_notes/model/test_issue_record.py
49-49: Use of assert
detected
(S101)
55-55: Use of assert
detected
(S101)
🔇 Additional comments (4)
release_notes_generator/model/issue_record.py (1)
30-34
: Good addition: capture GitHub Issue Type.Initialization handles None safely; aligns with the new tests.
tests/release_notes/model/test_pull_request_record.py (2)
25-50
: CR summary ignore-case works and assertion is clear.Good targeted fixture and patches; expected output matches parser behavior.
53-57
: Commit lookup test covers both paths.LGTM; considers present and missing SHAs.
tests/release_notes/model/test_issue_record.py (1)
46-55
: Issue type initialization is correctly validated.Both None and concrete type cases covered.
Release Notes:
Summary by CodeRabbit
New Features
Documentation
Tests