Reject gapped events#5
Merged
Merged
Conversation
Closed
There was a problem hiding this comment.
Pull request overview
This PR centralizes event validation so both file-loaded and directly provided events reject non-consecutive date sequences before rendering, while also bumping the package version and updating copyright years.
Changes:
- Adds
validate_eventsfor list/date format checks plus strict consecutive ordering. - Reuses validation from
read_eventsanddraw_calendar. - Adds regression tests for gapped events and updates metadata to 0.5.9 / 2026.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/drawcal/events.py |
Adds centralized event validation and applies it to file-loaded events. |
lib/drawcal/drawlib.py |
Validates directly supplied events before rendering. |
tests/test_events.py |
Adds tests for rejecting gapped events from files and direct validation. |
tests/test_render.py |
Adds render-entry validation coverage for gapped events. |
pyproject.toml |
Bumps project version to 0.5.9. |
lib/drawcal/__init__.py |
Bumps runtime package version and copyright year. |
LICENSE |
Updates copyright year. |
bin/drawcal |
Updates copyright year. |
lib/drawcal/cli.py |
Updates copyright year. |
lib/drawcal/config.py |
Updates copyright year. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new validation function for event data, ensuring that event date sequences are strictly increasing and consecutive, with no gaps. The validation logic is now centralized and reused across the codebase, improving data integrity and maintainability. The release version is also bumped to 0.5.9, and copyright years are updated.
Event validation improvements:
validate_eventsfunction indrawcal/events.pyto check that each event is a list of consecutive, strictly increasing date strings in "M/D/YYYY" format. This function raises descriptive errors for invalid input.read_eventsto usevalidate_events, removing duplicate validation logic and ensuring consistent checks for events loaded from files.draw_calendarindrawcal/drawlib.pyto callvalidate_eventswhen events are provided directly, enforcing validation for all event entry points. [1] [2]Testing enhancements:
tests/test_events.pyandtests/test_render.pyto verify that gapped or non-consecutive events are correctly rejected by both file and direct input validation. [1] [2] [3]Versioning and metadata:
pyproject.tomlanddrawcal/__init__.py. [1] [2]These changes ensure that event data is consistently validated, preventing subtle bugs and improving user feedback for incorrect input.