Conversation
Reviewer's GuideThis PR addresses lint issues across the codebase by introducing dedicated exception types for CLI errors, enforcing stricter CLI argument validation and type annotations, replacing os.remove with Path.unlink for safer file cleanup, and adding missing docstrings and type hints to test modules. Class diagram for new exception types in CLIclassDiagram
class UnexpectedExecutableError {
+__init__(executable: str)
}
UnexpectedExecutableError --|> ValueError
class ConcurrencyValueError {
+__init__(value: str)
}
ConcurrencyValueError --|> argparse.ArgumentTypeError
Class diagram for updated main function signature and usageclassDiagram
class main {
+main(paths: cabc.Iterable[Path], max_concurrent: int) -> int
}
class Semaphore {
}
main --> Semaphore : uses
main --> create_puppeteer_config : uses
main --> check_file : calls
Class diagram for updated positive_int functionclassDiagram
class positive_int {
+positive_int(value: str) -> int
}
positive_int --> ConcurrencyValueError : raises
Class diagram for updated create_puppeteer_config cleanupclassDiagram
class create_puppeteer_config {
+create_puppeteer_config() -> typ.Generator[Path]
}
create_puppeteer_config --> Path : uses
create_puppeteer_config : uses path.unlink() for cleanup
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Other AI code review bot(s) detectedCodeRabbit 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
WalkthroughIntroduce two custom exception classes ( Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant ExceptionHandler
User->>CLI: Run command with executable or concurrency value
CLI->>CLI: Validate executable
alt Executable not allowed
CLI->>ExceptionHandler: Raise UnexpectedExecutableError
else Executable allowed
CLI->>CLI: Validate concurrency value
alt Concurrency < 1
CLI->>ExceptionHandler: Raise ConcurrencyValueError
else Valid concurrency
CLI->>CLI: Proceed with processing
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `nixie/unittests/test_get_mmdc_cmd.py:20` </location>
<code_context>
def test_get_mmdc_cmd_with_bun(
- monkeypatch, sample_paths: tuple[Path, Path, Path]
+ monkeypatch: pytest.MonkeyPatch, sample_paths: tuple[Path, Path, Path]
</code_context>
<issue_to_address>
Consider adding a test for when all executables are missing.
Please add a test to verify behavior when none of the executables ('bun', 'mmdc', or 'npx') are available, ensuring the function responds appropriately.
Suggested implementation:
```python
def test_get_mmdc_cmd_with_no_executables(
monkeypatch: pytest.MonkeyPatch, sample_paths: tuple[Path, Path, Path]
) -> None:
"""Test behavior when no executables are available."""
mmd, svg, cfg = sample_paths
def which(cmd: str) -> None:
return None
monkeypatch.setattr("shutil.which", which)
# Import the function under test here if not already imported
# from nixie.get_mmdc_cmd import get_mmdc_cmd
# Expecting an exception (replace ExceptionType with the actual expected exception)
import pytest
with pytest.raises(Exception): # Replace Exception with the specific exception if known
get_mmdc_cmd(mmd, svg, cfg)
def test_get_mmdc_cmd_with_npx(
monkeypatch: pytest.MonkeyPatch, sample_paths: tuple[Path, Path, Path]
```
- Replace `Exception` in `pytest.raises(Exception)` with the specific exception your `get_mmdc_cmd` function raises when no executables are found (e.g., `FileNotFoundError`).
- If `get_mmdc_cmd` is not already imported in this test file, uncomment and adjust the import statement accordingly.
</issue_to_address>
### Comment 2
<location> `nixie/unittests/test_parse_blocks.py:33` </location>
<code_context>
assert parse_blocks("No diagrams here") == []
def test_parse_blocks_empty() -> None:
+ """Return an empty list for empty input."""
assert parse_blocks("") == []
</code_context>
<issue_to_address>
Consider adding a test for malformed or incomplete code blocks.
Adding tests for malformed or incomplete Mermaid code blocks, such as missing closing backticks or misspelled keywords, will help ensure the parser handles these scenarios correctly.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (1)
nixie/unittests/test_render_diagram.py (1)
87-87: Fix test to match updated exception type.The test expects
ValueErrorbut the implementation now raisesUnexpectedExecutableError. This will cause the test to fail.Apply this diff to fix the test:
- with pytest.raises(ValueError, match="Unexpected executable"): + with pytest.raises(UnexpectedExecutableError, match="Unexpected executable"):You'll also need to import the new exception:
-from nixie.cli import _render_diagram, _run_mermaid_cli, get_mmdc_cmd +from nixie.cli import _render_diagram, _run_mermaid_cli, get_mmdc_cmd, UnexpectedExecutableError
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
nixie/cli.py(7 hunks)nixie/unittests/test_get_mmdc_cmd.py(3 hunks)nixie/unittests/test_parse_blocks.py(2 hunks)nixie/unittests/test_render_diagram.py(4 hunks)nixie/unittests/test_verbose.py(4 hunks)tests/integration/conftest.py(2 hunks)tests/integration/test_cli_behavior.py(6 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.py
📄 CodeRabbit Inference Engine (AGENTS.md)
For Python files: Pass all relevant unit and behavioral tests, pass lint checks (
ruff check), adhere to formatting standards (ruff format), and pass type checking (pyright).
**/*.py: Use snake_case.py for file names, naming files for their contents (e.g., http_client.py, task_queue.py)
Use PascalCase for class names in Python files
Use snake_case for variable and function names in Python files
Use UPPER_SNAKE_CASE for module-level constants in Python files
Prefix private/internal helpers or APIs with a single underscore (_) in Python files
Use typing everywhere and maintain full static type coverage in Python files; use Pyright for type-checking
Use TypedDict or Dataclass for structured data where appropriate; for internal-only usage, prefer @DataClass(slots=True)
Avoid Any in type annotations; use Unknown, generics, or cast() when necessary, and always document why Any is acceptable if used
Be explicit with return types in public functions and class methods (e.g., use -> None, -> str, etc.)
Favor immutability in Python files; prefer tuples over lists, and frozendict or types.MappingProxyType where appropriate
Enable Ruff for linting and formatting; use Ruff to lint for performance, security, consistency, and style issues, and let Ruff handle whitespace and formatting entirely
Enforce strict mode in Pyright and treat all Pyright warnings as CI errors; use # pyright: ignore sparingly and with explanation
Avoid side effects at import time in Python modules; modules should not modify global state or perform actions on import
Use docstrings to document public functions, classes, and modules using NumPy format
Explain tricky code with inline comments for non-obvious logic or decisions in Python files
**/*.py: Use context managers to encapsulate setup and teardown logic cleanly and safely, especially for resource management (files, locks, connections, etc.), instead of manual try/finally blocks.
Use@contextmanagerfromcontextlibfor straightforward proce...
Files:
nixie/unittests/test_parse_blocks.pynixie/unittests/test_render_diagram.pynixie/unittests/test_verbose.pynixie/unittests/test_get_mmdc_cmd.pytests/integration/conftest.pynixie/cli.pytests/integration/test_cli_behavior.py
⚙️ CodeRabbit Configuration File
**/*.py: How about the following?- Keep cyclomatic complexity ≤ 12 - Follow single responsibility and CQRS (command/query segregation) - Docstrings must follow the `numpy` style guide. Use a single-line summary for private functions and methods, and full structured docs for all public interfaces. - Move conditionals with >2 branches to predicate/helper functions - Avoid `eval`, `exec`, `pickle`, monkey-patching, `ctypes`, unsafe shell - Every module must begin with a triple-quoted docstring explaining its purpose, utility, and usage, including example calls if appropriate. - Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar - Lint suppressions: - Blanket `# noqa`, file-level skips, and categories are **forbidden** - Only narrow in-line disables (`# noqa: XYZ`) are permitted, and must be accompanied by `FIXME:` or a ticket link, and used only as a last resort. - Use `pytest` fixtures for shared setup (`conftest.py` or `fixtures/`) - Replace duplicate tests with `@pytest.mark.parametrize` - Prefer `pytest-mock` or `unittest.mock` for stubs/mocks - Use `assert …, "message"` over bare asserts - Reflect all API/behaviour changes in `docs/` and update roadmap on completion - Files must not exceed 400 logical lines: - Decompose large modules into subpackages - Split large `match/case` or dispatch tables by domain and collocate with targets if appropriate - Move bulky data (fixtures, templates) to external files for parsing at runtime - Mutable defaults and shadowed built-ins are forbidden - All code must have clear type hints using modern style (`A | B`, `list[str]`, `class Foo[A]:`, `type Bar = int`, etc.), with ABC imports drawn from the correct stdlib module.
Files:
nixie/unittests/test_parse_blocks.pynixie/unittests/test_render_diagram.pynixie/unittests/test_verbose.pynixie/unittests/test_get_mmdc_cmd.pytests/integration/conftest.pynixie/cli.pytests/integration/test_cli_behavior.py
**/unittests/test_*.py
📄 CodeRabbit Inference Engine (.rules/python-00.mdc)
Colocate unit tests with code using a unittests subdirectory and a test_ prefix for test files
Files:
nixie/unittests/test_parse_blocks.pynixie/unittests/test_render_diagram.pynixie/unittests/test_verbose.pynixie/unittests/test_get_mmdc_cmd.py
**/test_*.py
📄 CodeRabbit Inference Engine (.rules/python-00.mdc)
**/test_*.py: Use pytest idioms in test files: prefer fixtures over setup/teardown methods, parametrize broadly, and avoid unnecessary mocks
Group related tests using class with method names prefixed by test_ in test files
Files:
nixie/unittests/test_parse_blocks.pynixie/unittests/test_render_diagram.pynixie/unittests/test_verbose.pynixie/unittests/test_get_mmdc_cmd.pytests/integration/test_cli_behavior.py
tests/integration/test_*.py
📄 CodeRabbit Inference Engine (.rules/python-00.mdc)
Structure integration tests separately in tests/integration/ directories
Files:
tests/integration/test_cli_behavior.py
🧬 Code Graph Analysis (2)
nixie/unittests/test_parse_blocks.py (1)
nixie/cli.py (1)
parse_blocks(54-56)
nixie/unittests/test_render_diagram.py (1)
nixie/cli.py (4)
cli(338-345)_render_diagram(151-205)_run_mermaid_cli(130-148)get_mmdc_cmd(85-99)
🔇 Additional comments (21)
nixie/unittests/test_parse_blocks.py (1)
1-1: Excellent documentation improvements.The added docstrings clearly describe each test's purpose and follow proper formatting standards. The module-level docstring provides good context for the file's purpose.
Also applies to: 18-18, 23-23, 29-29, 34-34
nixie/cli.py (8)
37-51: Well-designed custom exception classes.The new exception classes provide better error specificity than generic exceptions. The inheritance from
ValueErrorandargparse.ArgumentTypeErroris appropriate for their respective use cases.
82-82: Good modernisation using Path.unlink().Replacing
os.remove()withPath.unlink()is more idiomatic and consistent with the Path-based approach used throughout the codebase.
138-138: Improved error specificity with custom exceptions.The replacement of generic
ValueErrorwithUnexpectedExecutableErrorprovides better error context and makes the code more maintainable.Also applies to: 195-195
141-146: Appropriate security comment and formatting.The nosemgrep comment correctly addresses the security audit warning for subprocess creation, which is intentional here for CLI tool execution.
242-244: Improved string literal formatting for readability.Breaking the long error message into multiple string literals improves code readability whilst maintaining the same output.
286-287: Enhanced function signature with proper type annotations.The type annotations for
pathsandmax_concurrentparameters improve type safety and code clarity. The docstring update is also more descriptive.
295-296: Appropriate broad exception handling with documentation.The
BLE001noqa comment and explanatory comment justify catching all exceptions here, allowing the CLI to continue processing other files even when unexpected errors occur.
309-309: Consistent use of custom exception.Using
ConcurrencyValueErrorinstead of rawargparse.ArgumentTypeErrormaintains consistency with the new exception design pattern.nixie/unittests/test_render_diagram.py (1)
1-1: Good documentation improvements.The added docstrings clearly describe the purpose of each test function and provide better context for the test file.
Also applies to: 20-20, 53-53, 83-83
tests/integration/conftest.py (1)
1-1: Excellent documentation and type annotation improvements.The module-level docstring provides clear context, and the type annotation for the
monkeypatchparameter improves type safety. The fixture docstring clearly explains its purpose.Also applies to: 12-13
nixie/unittests/test_verbose.py (1)
1-1: Excellent test documentation improvements.The module-level docstring and individual test docstrings clearly describe the verbose logging behaviour being tested. The documentation enhances understanding without changing test logic.
Also applies to: 18-18, 31-31, 65-65
nixie/unittests/test_get_mmdc_cmd.py (3)
1-1: Keep the module docstring; LGTM.The succinct module-level docstring meets the guideline for test modules.
13-13: Keep the fixture docstring; LGTM.The one-line summary is clear and fits the fixture’s scope.
21-23: Retain explicit type formonkeypatch; LGTM.The annotation with
pytest.MonkeyPatchimproves type clarity and passes strict type checking.tests/integration/test_cli_behavior.py (6)
3-3: Keep the asyncio import; LGTM.The import is required for
asyncio.Semaphorein type annotations.
12-17: Introduce a test-only exception; LGTM.The dedicated exception improves clarity of the failure path exercised in tests.
80-80: Keep the docstring; LGTM.The test intent is clear and concise.
108-108: Keep the docstring; LGTM.The description matches the assertions for boundary markers.
138-138: Keep the docstring; LGTM.The behaviour under exceptions is clearly described.
149-154: Match the mock signature to the real function; LGTM.The expanded signature (including
cfg_pathandsemaphore) preserves interface parity and avoids accidental mismatches.
|
@coderabbitai please create new GitHub issues for the following: Please address the comments from this code review: Individual CommentsComment 1 def test_get_mmdc_cmd_with_bun(
<issue_to_address> Please add a test to verify behavior when none of the executables ('bun', 'mmdc', or 'npx') are available, ensuring the function responds appropriately. Suggested implementation: def test_get_mmdc_cmd_with_no_executables(
monkeypatch: pytest.MonkeyPatch, sample_paths: tuple[Path, Path, Path]
) -> None:
"""Test behavior when no executables are available."""
mmd, svg, cfg = sample_paths
def which(cmd: str) -> None:
return None
monkeypatch.setattr("shutil.which", which)
# Import the function under test here if not already imported
# from nixie.get_mmdc_cmd import get_mmdc_cmd
# Expecting an exception (replace ExceptionType with the actual expected exception)
import pytest
with pytest.raises(Exception): # Replace Exception with the specific exception if known
get_mmdc_cmd(mmd, svg, cfg)
def test_get_mmdc_cmd_with_npx(
monkeypatch: pytest.MonkeyPatch, sample_paths: tuple[Path, Path, Path]
Comment 2 def test_parse_blocks_empty() -> None:
<issue_to_address> Adding tests for malformed or incomplete Mermaid code blocks, such as missing closing backticks or misspelled keywords, will help ensure the parser handles these scenarios correctly. |
🧩 Analysis chain@leynos Done. I created two GitHub issues with backlinks to PR #17 and assigned them to you:
If you want me to refine acceptance criteria to name the exact exception type raised by get_mmdc_cmd, say the word and I’ll update the issue. 🏁 Script executed: Length of output: 14433 @leynos Created the two GitHub issues and assigned them to you:
I tailored the acceptance criteria to match current code:
If you want me to update either issue with more specific assertions (e.g., the exact error message text), say the word and I’ll amend them. 🏁 Script executed: Length of output: 3329 @leynos Issue 1 was created successfully earlier: #18. I’ve now created Issue 2 as well (the previous failure was due to unescaped backticks in the heredoc). If you want any tweaks to the acceptance criteria, tell me and I’ll amend the issues. 🏁 Script executed: Length of output: 2001 @leynos Created both issues and assigned them to you:
Both include backlinks to PR #17 and the specific review comments. I aligned the acceptance criteria with current behaviour (get_mmdc_cmd falls back to npx; absence errors surface at execution time). Want me to add labels or tweak wording? ✅ Actions performedComments resolved and changes approved. |
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (2)
nixie/unittests/test_get_mmdc_cmd.py (2)
33-35: Add an assertion message for clarity.Augment the assert with a message per the testing guideline.
- assert cmd[:3] == ["bun", "x", "--bun"] + assert cmd[:3] == ["bun", "x", "--bun"], "Use Bun when available"
45-46: Add an assertion message for clarity.Add a short message to explain the expectation.
- assert cmd[:4] == ["npx", "--yes", "@mermaid-js/mermaid-cli", "mmdc"] + assert cmd[:4] == ["npx", "--yes", "@mermaid-js/mermaid-cli", "mmdc"], "Fall back to npx when Bun and mmdc are unavailable"
♻️ Duplicate comments (2)
nixie/unittests/test_get_mmdc_cmd.py (1)
38-40: Acknowledge docstring grammar fix.“Fall back” and proper-noun capitalisation are correct; this addresses the earlier nitpick.
tests/integration/test_cli_behavior.py (1)
1-1: Retain en-GB spelling in the module docstring — resolved.Keep the en-GB spelling (“behaviour”) as done here; this addresses the earlier nit.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
nixie/unittests/test_get_mmdc_cmd.py(3 hunks)tests/integration/test_cli_behavior.py(6 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.py
📄 CodeRabbit Inference Engine (AGENTS.md)
For Python files: Pass all relevant unit and behavioral tests, pass lint checks (
ruff check), adhere to formatting standards (ruff format), and pass type checking (pyright).
**/*.py: Use snake_case.py for file names, naming files for their contents (e.g., http_client.py, task_queue.py)
Use PascalCase for class names in Python files
Use snake_case for variable and function names in Python files
Use UPPER_SNAKE_CASE for module-level constants in Python files
Prefix private/internal helpers or APIs with a single underscore (_) in Python files
Use typing everywhere and maintain full static type coverage in Python files; use Pyright for type-checking
Use TypedDict or Dataclass for structured data where appropriate; for internal-only usage, prefer @DataClass(slots=True)
Avoid Any in type annotations; use Unknown, generics, or cast() when necessary, and always document why Any is acceptable if used
Be explicit with return types in public functions and class methods (e.g., use -> None, -> str, etc.)
Favor immutability in Python files; prefer tuples over lists, and frozendict or types.MappingProxyType where appropriate
Enable Ruff for linting and formatting; use Ruff to lint for performance, security, consistency, and style issues, and let Ruff handle whitespace and formatting entirely
Enforce strict mode in Pyright and treat all Pyright warnings as CI errors; use # pyright: ignore sparingly and with explanation
Avoid side effects at import time in Python modules; modules should not modify global state or perform actions on import
Use docstrings to document public functions, classes, and modules using NumPy format
Explain tricky code with inline comments for non-obvious logic or decisions in Python files
**/*.py: Use context managers to encapsulate setup and teardown logic cleanly and safely, especially for resource management (files, locks, connections, etc.), instead of manual try/finally blocks.
Use@contextmanagerfromcontextlibfor straightforward proce...
Files:
nixie/unittests/test_get_mmdc_cmd.pytests/integration/test_cli_behavior.py
⚙️ CodeRabbit Configuration File
**/*.py: How about the following?- Keep cyclomatic complexity ≤ 12 - Follow single responsibility and CQRS (command/query segregation) - Docstrings must follow the `numpy` style guide. Use a single-line summary for private functions and methods, and full structured docs for all public interfaces. - Move conditionals with >2 branches to predicate/helper functions - Avoid `eval`, `exec`, `pickle`, monkey-patching, `ctypes`, unsafe shell - Every module must begin with a triple-quoted docstring explaining its purpose, utility, and usage, including example calls if appropriate. - Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar - Lint suppressions: - Blanket `# noqa`, file-level skips, and categories are **forbidden** - Only narrow in-line disables (`# noqa: XYZ`) are permitted, and must be accompanied by `FIXME:` or a ticket link, and used only as a last resort. - Use `pytest` fixtures for shared setup (`conftest.py` or `fixtures/`) - Replace duplicate tests with `@pytest.mark.parametrize` - Prefer `pytest-mock` or `unittest.mock` for stubs/mocks - Use `assert …, "message"` over bare asserts - Reflect all API/behaviour changes in `docs/` and update roadmap on completion - Files must not exceed 400 logical lines: - Decompose large modules into subpackages - Split large `match/case` or dispatch tables by domain and collocate with targets if appropriate - Move bulky data (fixtures, templates) to external files for parsing at runtime - Mutable defaults and shadowed built-ins are forbidden - All code must have clear type hints using modern style (`A | B`, `list[str]`, `class Foo[A]:`, `type Bar = int`, etc.), with ABC imports drawn from the correct stdlib module.
Files:
nixie/unittests/test_get_mmdc_cmd.pytests/integration/test_cli_behavior.py
**/unittests/test_*.py
📄 CodeRabbit Inference Engine (.rules/python-00.mdc)
Colocate unit tests with code using a unittests subdirectory and a test_ prefix for test files
Files:
nixie/unittests/test_get_mmdc_cmd.py
**/test_*.py
📄 CodeRabbit Inference Engine (.rules/python-00.mdc)
**/test_*.py: Use pytest idioms in test files: prefer fixtures over setup/teardown methods, parametrize broadly, and avoid unnecessary mocks
Group related tests using class with method names prefixed by test_ in test files
Files:
nixie/unittests/test_get_mmdc_cmd.pytests/integration/test_cli_behavior.py
tests/integration/test_*.py
📄 CodeRabbit Inference Engine (.rules/python-00.mdc)
Structure integration tests separately in tests/integration/ directories
Files:
tests/integration/test_cli_behavior.py
🔇 Additional comments (7)
nixie/unittests/test_get_mmdc_cmd.py (2)
13-17: Approve fixture docstring and typing.Docstring clarity and explicit return typing align with the guidelines.
21-23: Approve typed signature and docstring.Typed monkeypatch and clear, concise test intent are spot on.
tests/integration/test_cli_behavior.py (5)
12-17: Define a dedicated test-only exception — LGTM.Use a clear, typed exception for simulated failures; the docstring and explicit message aid diagnostics.
80-80: Document test purpose succinctly — LGTM.Keep concise docstrings on tests to clarify intent.
108-108: Document boundary-marking expectations — LGTM.Capture the behavioural contract of CLI file-boundary output.
138-138: Explain error-handling intent — LGTM.State the expectation that processing continues after an exception from check_file.
148-154: Match the real function’s signature in the mock — LGTM.Keep the mock signature aligned (path, cfg_path, semaphore, *args, **kwargs) and typed; this preserves call sites and introspection.
| @@ -1,3 +1,5 @@ | |||
| """Unit tests for :mod:`nixie.cli.get_mmdc_cmd`.""" | |||
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Use the correct Sphinx role for functions.
Use :func: instead of :mod: when referencing a function.
-"""Unit tests for :mod:`nixie.cli.get_mmdc_cmd`."""
+"""Unit tests for :func:`nixie.cli.get_mmdc_cmd`."""📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| """Unit tests for :mod:`nixie.cli.get_mmdc_cmd`.""" | |
| """Unit tests for :func:`nixie.cli.get_mmdc_cmd`.""" |
🤖 Prompt for AI Agents
In nixie/unittests/test_get_mmdc_cmd.py at line 1, the docstring incorrectly
uses the Sphinx role :mod: to reference a function. Replace :mod: with :func: to
correctly indicate that the reference is to a function, updating the docstring
to use :func:`nixie.cli.get_mmdc_cmd` instead.
| raise SimulatedProcessingError() # noqa: RSE102 - explicit instance for clarity | ||
| return await original_check_file(path, cfg_path, semaphore, *args, **kwargs) |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Amend the noqa to comply with the lint-suppression policy.
Attach a “FIXME:” or ticket link to the inline suppression per repo rules; keep raising an explicit instance in tests for clarity.
Apply this diff to update the suppression comment:
- raise SimulatedProcessingError() # noqa: RSE102 - explicit instance for clarity
+ raise SimulatedProcessingError() # noqa: RSE102 - FIXME: document style decision (link); raising an explicit instance is intentional in testsWant me to open a tracking issue and reference it here?
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| raise SimulatedProcessingError() # noqa: RSE102 - explicit instance for clarity | |
| return await original_check_file(path, cfg_path, semaphore, *args, **kwargs) | |
| raise SimulatedProcessingError() # noqa: RSE102 - FIXME: document style decision (link); raising an explicit instance is intentional in tests | |
| return await original_check_file(path, cfg_path, semaphore, *args, **kwargs) |
🤖 Prompt for AI Agents
In tests/integration/test_cli_behavior.py at lines 156-157, the noqa comment
suppressing the lint warning RSE102 needs to be updated to comply with the
repo's lint-suppression policy by adding a "FIXME:" note or a ticket link. Keep
raising the explicit instance of SimulatedProcessingError for clarity, but amend
the inline suppression comment to include the required reference or note as per
guidelines.
Summary
Testing
make lintmake fmtmake typecheckmake testhttps://chatgpt.com/codex/tasks/task_e_68953a50c7988322ac772a01b981977d
Summary by Sourcery
Fix lint issues by introducing dedicated exception types, improving CLI argument validation and error handling, replacing os.remove with Path.unlink, and adding missing type annotations and docstrings across the codebase and tests.
Enhancements:
Documentation:
Tests: