Skip to content

chore: format files in API server#8292

Merged
sriramveeraghanta merged 1 commit into
previewfrom
fix-format-files
Dec 10, 2025
Merged

chore: format files in API server#8292
sriramveeraghanta merged 1 commit into
previewfrom
fix-format-files

Conversation

@sriramveeraghanta

@sriramveeraghanta sriramveeraghanta commented Dec 10, 2025

Copy link
Copy Markdown
Member

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • Style
    • Code formatting improvements across multiple files, including line wrapping consolidation, trailing newline normalization, and minor spacing adjustments. No functional changes to application behavior or features.

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

Copilot AI review requested due to automatic review settings December 10, 2025 10:31
@coderabbitai

coderabbitai Bot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request applies code formatting changes across the API, authentication, background tasks, utilities, tests, and license modules. Changes include consolidating multi-line expressions to single lines, adjusting end-of-file newlines, and removing extraneous whitespace. No functional logic modifications, control flow changes, or behavioral impact.

Changes

Cohort / File(s) Summary
Serializers formatting
apps/api/plane/api/serializers/__init__.py, apps/api/plane/api/serializers/project.py
End-of-file newline additions and removal of redundant whitespace in class declarations.
URL routing formatting
apps/api/plane/api/urls/invite.py, apps/api/plane/app/urls/exporter.py
End-of-file newline adjustments to routing configuration files.
API view formatting
apps/api/plane/api/views/cycle.py, apps/api/plane/api/views/member.py
Consolidated multi-line queryset filters and function calls to single lines; removed blank lines before class decorators.
Asset view formatting
apps/api/plane/app/views/asset/v2.py
Collapsed multi-line cache invalidation and presigned URL generation calls; reformatted asset retrieval expressions.
Cycle and page view formatting
apps/api/plane/app/views/cycle/base.py, apps/api/plane/app/views/issue/label.py, apps/api/plane/app/views/page/base.py
Consolidated multi-line Django ORM queries, serializer instantiations, and prefetch expressions into single lines.
Authentication provider formatting
apps/api/plane/authentication/adapter/base.py, apps/api/plane/authentication/provider/oauth/gitea.py, apps/api/plane/authentication/views/app/gitea.py
Reformatted function calls and constructor invocations from multi-line to single-line expressions.
Background task formatting
apps/api/plane/bgtasks/page_transaction_task.py, apps/api/plane/bgtasks/workspace_seed_task.py
Removed blank lines and consolidated bulk\_create calls; reformatted model instantiation lists.
License view formatting
apps/api/plane/license/api/views/admin.py
Restructured function call from passthrough style to explicit multi-line argument style.
Utility module formatting
apps/api/plane/utils/content_validator.py, apps/api/plane/utils/cycle_transfer_issues.py, apps/api/plane/utils/openapi/decorators.py
Consolidated conditional checks and Django ORM operations; added trailing newlines and formatting adjustments.
Test formatting
apps/api/plane/tests/unit/serializers/test_label.py
Consolidated multi-line test setup expressions into single-line statements.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~8 minutes

Notes:

  • Overwhelming majority of changes are homogeneous, repetitive formatting adjustments (line consolidation, newline fixes, whitespace normalization)
  • No new logic, control flow changes, or behavioral modifications across any file
  • Review can focus on verifying that formatting changes do not inadvertently alter semantics (e.g., line-wrapping does not change operator precedence or argument grouping)
  • High file count mitigated by consistency and simplicity of each individual change

Poem

🐰✨ Lines align, the code flows clean,
Multi-statement dreams now compressed serene,
A rabbit's care for formatting grace,
Each newline trimmed to find its place,
Hopping through style with a joyful cheer! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and largely empty. While 'Code refactoring' is mentioned in the template, it was not actually checked, and the required 'Description' section is entirely missing. Add a detailed description of the formatting changes made and ensure the appropriate checkbox for 'Code refactoring' is marked with an 'x'.
Docstring Coverage ⚠️ Warning Docstring coverage is 37.74% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: format files in API server' directly and clearly summarizes the main change—code formatting across API server files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-format-files

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20510bb and 736c4e2.

📒 Files selected for processing (20)
  • apps/api/plane/api/serializers/__init__.py (1 hunks)
  • apps/api/plane/api/serializers/project.py (1 hunks)
  • apps/api/plane/api/urls/invite.py (1 hunks)
  • apps/api/plane/api/views/cycle.py (18 hunks)
  • apps/api/plane/api/views/member.py (0 hunks)
  • apps/api/plane/app/urls/exporter.py (1 hunks)
  • apps/api/plane/app/views/asset/v2.py (18 hunks)
  • apps/api/plane/app/views/cycle/base.py (18 hunks)
  • apps/api/plane/app/views/issue/label.py (1 hunks)
  • apps/api/plane/app/views/page/base.py (2 hunks)
  • apps/api/plane/authentication/adapter/base.py (1 hunks)
  • apps/api/plane/authentication/provider/oauth/gitea.py (2 hunks)
  • apps/api/plane/authentication/views/app/gitea.py (3 hunks)
  • apps/api/plane/bgtasks/page_transaction_task.py (1 hunks)
  • apps/api/plane/bgtasks/workspace_seed_task.py (1 hunks)
  • apps/api/plane/license/api/views/admin.py (1 hunks)
  • apps/api/plane/tests/unit/serializers/test_label.py (2 hunks)
  • apps/api/plane/utils/content_validator.py (1 hunks)
  • apps/api/plane/utils/cycle_transfer_issues.py (6 hunks)
  • apps/api/plane/utils/openapi/decorators.py (2 hunks)
💤 Files with no reviewable changes (1)
  • apps/api/plane/api/views/member.py
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-07-23T18:18:06.875Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7460
File: apps/api/plane/app/serializers/draft.py:112-122
Timestamp: 2025-07-23T18:18:06.875Z
Learning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.

Applied to files:

  • apps/api/plane/bgtasks/workspace_seed_task.py
  • apps/api/plane/api/serializers/project.py
  • apps/api/plane/app/views/issue/label.py
📚 Learning: 2025-09-12T07:29:36.083Z
Learnt from: dheeru0198
Repo: makeplane/plane PR: 7625
File: apps/api/plane/bgtasks/workspace_seed_task.py:95-98
Timestamp: 2025-09-12T07:29:36.083Z
Learning: In the Plane codebase, workspace seed data should have project features (cycle_view, module_view, issue_views_view) enabled by default, even when regular project creation has these features disabled. This provides users with a complete demo experience in the seeded workspace.

Applied to files:

  • apps/api/plane/bgtasks/workspace_seed_task.py
📚 Learning: 2025-10-17T08:23:54.961Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7966
File: apps/api/plane/bgtasks/page_transaction_task.py:108-127
Timestamp: 2025-10-17T08:23:54.961Z
Learning: In the page transaction system (apps/api/plane/bgtasks/page_transaction_task.py), entity names (entity_name) and entity identifiers (entity_identifier) for mentions and components remain constant once set and are not hardcoded values that change, so PageLog records don't need to handle updates to existing entity attributes.

Applied to files:

  • apps/api/plane/bgtasks/page_transaction_task.py
📚 Learning: 2025-10-17T08:21:37.517Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7966
File: apps/api/plane/bgtasks/page_transaction_task.py:37-39
Timestamp: 2025-10-17T08:21:37.517Z
Learning: In `apps/api/plane/bgtasks/page_transaction_task.py`, the `component_map` variable is intentionally kept separate from `COMPONENT_MAP` to allow other modules to extend it with additional component types in the future, even though it currently just copies `COMPONENT_MAP`.

Applied to files:

  • apps/api/plane/bgtasks/page_transaction_task.py
📚 Learning: 2025-10-17T10:46:13.825Z
Learnt from: NarayanBavisetti
Repo: makeplane/plane PR: 7969
File: apps/api/plane/api/views/cycle.py:1218-1228
Timestamp: 2025-10-17T10:46:13.825Z
Learning: In the cycle transfer functionality in apps/api/plane/api/views/cycle.py, transfers should only be allowed from completed cycles (end_date < timezone.now()), not from active or draft cycles. The guard should block when end_date is None or end_date >= timezone.now().

Applied to files:

  • apps/api/plane/api/views/cycle.py
  • apps/api/plane/app/views/cycle/base.py
🧬 Code graph analysis (10)
apps/api/plane/bgtasks/workspace_seed_task.py (2)
apps/api/plane/db/models/project.py (1)
  • ProjectMember (192-236)
apps/api/plane/db/models/issue.py (1)
  • IssueUserProperty (541-568)
apps/api/plane/bgtasks/page_transaction_task.py (1)
apps/api/plane/db/models/page.py (1)
  • PageLog (76-113)
apps/api/plane/app/views/page/base.py (1)
apps/api/plane/db/models/page.py (1)
  • Page (19-73)
apps/api/plane/api/serializers/project.py (1)
apps/api/plane/api/serializers/base.py (1)
  • BaseSerializer (5-114)
apps/api/plane/authentication/views/app/gitea.py (1)
apps/api/plane/authentication/provider/oauth/gitea.py (1)
  • GiteaOAuthProvider (16-169)
apps/api/plane/api/serializers/__init__.py (1)
apps/api/plane/api/serializers/sticky.py (1)
  • StickySerializer (8-30)
apps/api/plane/app/views/asset/v2.py (1)
apps/api/plane/settings/storage.py (1)
  • generate_presigned_post (61-95)
apps/api/plane/utils/cycle_transfer_issues.py (1)
apps/api/plane/db/models/cycle.py (2)
  • Cycle (56-97)
  • CycleIssue (100-123)
apps/api/plane/app/views/issue/label.py (1)
apps/api/plane/app/serializers/issue.py (1)
  • LabelSerializer (356-381)
apps/api/plane/app/views/cycle/base.py (2)
apps/api/plane/db/models/user.py (1)
  • User (42-168)
apps/api/plane/app/serializers/cycle.py (1)
  • CycleWriteSerializer (11-39)
⏰ 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). (3)
  • GitHub Check: Upload results
  • GitHub Check: Lint API
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (39)
apps/api/plane/app/urls/exporter.py (1)

6-12: LGTM!

The trailing newline addition follows POSIX file formatting standards. No functional changes to the URL configuration.

apps/api/plane/api/urls/invite.py (1)

16-18: LGTM!

End-of-file newline addition maintains consistent formatting. URL routing configuration is unchanged.

apps/api/plane/bgtasks/workspace_seed_task.py (2)

110-121: LGTM!

The multi-line formatting improves readability for the bulk_create operation with list comprehension. No functional changes.


124-163: LGTM!

The expanded multi-line format significantly improves readability for this complex bulk_create with nested display_filters and display_properties dictionaries. The formatting change makes the structure of IssueUserProperty objects much clearer without altering behavior.

apps/api/plane/utils/content_validator.py (1)

57-62: LGTM!

The condensed single-line format for the any() check is appropriate given the expression's simplicity. The suspicious pattern detection logic remains unchanged.

apps/api/plane/tests/unit/serializers/test_label.py (2)

11-26: LGTM!

The single-line Project.objects.create is concise and readable. Test logic for valid label creation remains intact.


28-37: LGTM!

The consolidated single-line formatting for both Project.objects.create and LabelSerializer instantiation improves conciseness. The duplicate name validation test correctly verifies the serializer's validate_name behavior.

apps/api/plane/api/serializers/project.py (1)

20-20: LGTM!

Formatting cleanup on the class declaration line. No functional changes.

apps/api/plane/authentication/adapter/base.py (1)

93-95: LGTM!

Multi-line formatting of the get_configuration_value call improves readability while preserving identical behavior.

apps/api/plane/api/serializers/__init__.py (1)

58-58: LGTM!

Trailing newline added at end-of-file, consistent with POSIX standards.

apps/api/plane/utils/openapi/decorators.py (1)

266-280: LGTM!

Formatting adjustments (blank line before sticky_docs and trailing EOF newline) align with the consistent style used throughout this file for other decorator functions.

apps/api/plane/license/api/views/admin.py (1)

137-140: LGTM!

Multi-line formatting of the base_host call. Behavior unchanged.

apps/api/plane/app/views/page/base.py (1)

498-504: PagesDescriptionViewSet get() calls are formatting-only and preserve behavior

The Page.objects.get calls still apply the same ownership/public-access constraint plus workspace/project filters; only line-wrapping changed. No behavioral impact.

Also applies to: 518-524

apps/api/plane/bgtasks/page_transaction_task.py (1)

127-132: Bulk-create formatting change is safe

bulk_create uses the same queryset, batch size, and ignore_conflicts=True; only formatting changed, so behavior is unchanged.

apps/api/plane/app/views/issue/label.py (1)

40-47: LabelSerializer create call unchanged semantically

Serializer still receives data=request.data and context={"project_id": project_id}; only formatting changed, so create logic and validation remain the same.

apps/api/plane/authentication/views/app/gitea.py (1)

33-53: Gitea auth/redirect construction remains intact

The urljoin and GiteaOAuthProvider calls keep the same arguments and flow; only line-wrapping changed, so OAuth behavior and error redirects are unaffected.

Also applies to: 85-87

apps/api/plane/authentication/provider/oauth/gitea.py (1)

84-110: Token/user data construction unchanged

refresh_token_expired_at still uses the same timestamp field and UTC timezone, and the user payload passed to super().set_user_data is identical; only formatting was adjusted.

Also applies to: 145-169

apps/api/plane/app/views/asset/v2.py (1)

37-75: Asset cache invalidation, presign generation, and filters are formatting-only

The changes to invalidate_cache_directly, generate_presigned_post, FileAsset creation (**get_entity_id_field(...)), and project/workspace-based get() calls keep the same arguments and constraints; only line-wrapping and style were adjusted. Behavior for uploading, patching, deleting, and checking assets remains the same.

Also applies to: 152-156, 243-265, 351-365, 549-565, 593-606, 636-639, 690-694

apps/api/plane/api/views/cycle.py (5)

186-199: Cycle list, archived list, and cycle issue list changes are stylistic

The current and incomplete filters, archived-cycle pagination lambda, cycle issue queryset, and detail serializer calls all preserve the original filter predicates and arguments; only line-wrapping and lambda formatting were changed, so behavior is unchanged.

Also applies to: 253-266, 735-739, 848-889, 1051-1064


301-305: Cycle creation validation remains consistent after formatting

The condition requiring both start_date and end_date to be either both set or both null, and the error message when this isn’t satisfied, are unchanged except for formatting. No behavioral change here.

Also applies to: 341-349


580-601: Cycle delete activity and cleanup formatting change is safe

Material behavior—collecting cycle_issues, sending issue_activity, deleting the cycle, and then removing related UserFavorite entries—remains the same; only list construction and filter call are reformatted.


751-772: Archive/unarchive endpoints: queryset scopes unchanged

The archive and unarchive endpoints still select the cycle by pk, project_id, and workspace__slug and enforce the same “only completed cycles can be archived” and simple unarchive behavior; changes are to formatting only.

Also applies to: 782-791


908-988: CycleIssue bulk add/move behavior preserved

The logic for:

  • rejecting empty issues lists,
  • loading the target cycle and blocking when completed,
  • creating new CycleIssue records for new_issues,
  • moving existing cycle_issues and recording activity,
    is unchanged; only queryset/serialization expressions were reflowed onto single lines.
apps/api/plane/app/views/cycle/base.py (16)

98-102: LGTM!

Formatting consolidation of the prefetch queryset is clean and maintains readability.


148-176: LGTM!

The status annotation Case/When expressions and assignee_ids filter are reformatted without logic changes.


200-201: LGTM!

Filter expression consolidated to single line while preserving the current cycle date range logic.


266-329: LGTM!

The create method changes are purely formatting - serializer instantiation, timezone conversion call, and error response dict consolidated to single lines.


331-355: LGTM!

The partial_update method formatting changes maintain clarity while consolidating multi-line expressions.


454-455: LGTM!

Error response formatting is clean and concise.


476-477: LGTM!

Query expression consolidated appropriately.


528-532: LGTM!

The convert_to_utc call formatting is consistent with the existing style for end_date conversion below.


631-636: LGTM!

Property assignments reformatted consistently.


656-659: LGTM!

Query and error response formatting is clean.


703-706: LGTM!

Sum annotation consolidated appropriately.


763-779: LGTM!

Response dictionary key-value pairs reformatted consistently.


786-801: LGTM!

Cycle query filter consolidated to single line.


869-870: LGTM!

Sum annotation formatting consolidated.


904-905: LGTM!

Sum annotation formatting consolidated.


1006-1007: LGTM!

Count annotation with filter consolidated to single line.


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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 applies consistent code formatting across multiple Python files in the API server. The changes are purely cosmetic, improving code readability without modifying any logic or behavior.

Key changes:

  • Reformatted long lines by breaking them into multiple lines with proper indentation
  • Removed unnecessary blank lines and trailing whitespace for consistency
  • Fixed minor spacing issues (e.g., extra space in class declaration)

Reviewed changes

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

Show a summary per file
File Description
apps/api/plane/utils/openapi/decorators.py Added blank line for separation, fixed trailing whitespace
apps/api/plane/utils/cycle_transfer_issues.py Reformatted long filter/annotate chains and conditional expressions
apps/api/plane/utils/content_validator.py Simplified multi-line conditional expression
apps/api/plane/tests/unit/serializers/test_label.py Reformatted long constructor calls
apps/api/plane/license/api/views/admin.py Improved function call line wrapping
apps/api/plane/bgtasks/workspace_seed_task.py Reformatted bulk_create calls with list comprehensions
apps/api/plane/bgtasks/page_transaction_task.py Removed unnecessary blank lines, reformatted bulk_create call
apps/api/plane/authentication/views/app/gitea.py Simplified urljoin and provider initialization calls
apps/api/plane/authentication/provider/oauth/gitea.py Reformatted datetime.fromtimestamp call, fixed trailing whitespace
apps/api/plane/authentication/adapter/base.py Reformatted get_configuration_value call
apps/api/plane/app/views/page/base.py Reformatted Page.objects.get calls
apps/api/plane/app/views/issue/label.py Reformatted LabelSerializer initialization
apps/api/plane/app/views/cycle/base.py Extensive reformatting of queryset operations, annotations, and conditionals
apps/api/plane/app/views/asset/v2.py Reformatted invalidate_cache_directly and other method calls, removed blank lines
apps/api/plane/app/urls/exporter.py Fixed trailing whitespace
apps/api/plane/api/views/member.py Removed unnecessary blank line
apps/api/plane/api/views/cycle.py Comprehensive reformatting of cycle-related view methods
apps/api/plane/api/urls/invite.py Fixed trailing whitespace
apps/api/plane/api/serializers/project.py Fixed extra whitespace in class declaration
apps/api/plane/api/serializers/init.py Fixed trailing whitespace

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

request_data = {
"sort_order": request_data.get("sort_order", cycle.sort_order)
}
request_data = {"sort_order": request_data.get("sort_order", cycle.sort_order)}

Copilot AI Dec 10, 2025

Copy link

Choose a reason for hiding this comment

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

Variable request_data is not used.

Copilot uses AI. Check for mistakes.
request_data = {
"sort_order": request_data.get("sort_order", cycle.sort_order)
}
request_data = {"sort_order": request_data.get("sort_order", cycle.sort_order)}

Copilot AI Dec 10, 2025

Copy link

Choose a reason for hiding this comment

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

Variable request_data is not used.

Copilot uses AI. Check for mistakes.
cycle_issues = CycleIssue.objects.bulk_update(
updated_cycles, ["cycle_id"], batch_size=100
)
cycle_issues = CycleIssue.objects.bulk_update(updated_cycles, ["cycle_id"], batch_size=100)

Copilot AI Dec 10, 2025

Copy link

Choose a reason for hiding this comment

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

Variable cycle_issues is not used.

Suggested change
cycle_issues = CycleIssue.objects.bulk_update(updated_cycles, ["cycle_id"], batch_size=100)
CycleIssue.objects.bulk_update(updated_cycles, ["cycle_id"], batch_size=100)

Copilot uses AI. Check for mistakes.
@sriramveeraghanta sriramveeraghanta merged commit 97e21ba into preview Dec 10, 2025
15 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-format-files branch December 10, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants