Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request updates copyright year ranges across approximately 45 configuration and source files throughout the codebase, and refactors the copyright header validation in the test suite with new helper functions for year formatting, git-based year tracking, and centralized header validation logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@src/cloudai/workloads/ddlb/slurm_command_gen_strategy.py`:
- Line 2: The file header's copyright year range is inconsistent with other
files; update the top comment in slurm_command_gen_strategy.py to use the
standardized range (e.g., change "Copyright (c) 2024-2026" to the agreed range
used across the repo such as "2024-2026" or "2025-2026") so all updated files
share the same copyright years; locate the header comment at the top of the file
and replace the existing year range text accordingly to match the standard used
across the project.
In `@tests/test_check_copyright_headers.py`:
- Line 47: CURRENT_YEAR is evaluated at import time which can cause failures
across a year boundary; move the computation into get_commit_years_for_file so
the year is calculated at call time. Update get_commit_years_for_file to compute
current_year = datetime.now().year (or use datetime.utcnow() if needed for
timezone consistency) and use that local variable instead of the module-level
CURRENT_YEAR constant; remove or deprecate the top-level CURRENT_YEAR to avoid
stale values.
- Around line 76-86: Add a negative test that verifies
_format_years_to_ranges([]) raises the expected ValueError: create a new test
function (e.g., test_format_years_to_ranges_empty_raises) that calls
_format_years_to_ranges with an empty list and uses pytest.raises(ValueError,
match="Expected at least one year") to assert the error and message; place it
alongside the existing tests in tests/test_check_copyright_headers.py.
- Around line 127-141: Update the assertions in _assert_copyright_in_file to
include actual vs expected values and file context to improve debuggability: for
the SPDX check (actual_copyright_lines[0]), the years check
(actual_copyright_lines[1] vs expected_years_line) and the tail check
("\n".join(actual_copyright_lines[2:]) vs HEADER_TAIL) include the file name
plus both expected and actual values in each assertion message; reference the
variables actual_copyright_lines, expected_years_line, HEADER_TAIL and
HEADER_LINES so the failure output clearly shows what was expected and what was
received.
- Around line 96-106: The git subprocess invocations that populate `res` (the
two subprocess.run calls using ["git", "log", ...] and any other git
subprocess.run calls like git status) lack return-code checks and can fail
silently; update these calls to either use check=True or inspect
`res.returncode` and throw a descriptive exception (or raise
subprocess.CalledProcessError) including `res.stderr` and the command arguments
when non-zero, so the test fails with a clear error instead of returning an
incorrect year value; ensure you update all occurrences around the
`res`/`path_str` usage (the git log/status subprocess.run calls) accordingly.
Greptile OverviewGreptile SummaryThis PR updates copyright headers across 52 files to accurately reflect the years when files were modified, based on git commit history. The main improvement is in
Key improvements:
Confidence Score: 5/5
Important Files Changed
|
Summary
Fix copyright and the related check according to the rule: copyright years must cover all but only the years when the file was changed.
The was also a bug in the current copyright check: it ignored the start range year to check.
Example:
Test Plan
Unit-tests are enough + verified a sample of affected files manually using the git log command from the check function
Additional Notes