Skip to content

Fix unused comment flag - #28

Merged
glenn-jocher merged 2 commits into
mainfrom
update-format-headers-redirects-20260612201348
Jun 12, 2026
Merged

Fix unused comment flag#28
glenn-jocher merged 2 commits into
mainfrom
update-format-headers-redirects-20260612201348

Conversation

@pderrenger

@pderrenger pderrenger commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • remove the unused walrus assignment in the comment capitalization hook
  • run Ruff formatting on the touched file

Tests

  • ruff check --select F841 capitalize_comments.py
  • ruff check capitalize_comments.py
  • ruff format capitalize_comments.py
  • python -m py_compile capitalize_comments.py
  • git diff --check

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

🧹 This PR makes a small cleanup in capitalize_comments.py by removing an unused inline variable assignment while keeping behavior unchanged.

📊 Key Changes

  • Removed the walrus operator assignment in the comment check:
    • Changed if is_comment := line.strip().startswith("#"): to if line.strip().startswith("#"):
  • Kept the script’s logic exactly the same:
    • Comment lines are still detected and processed as before.
    • prev_was_comment behavior is unchanged.

🎯 Purpose & Impact

  • Improves code clarity ✨ by removing an unnecessary variable that was not used elsewhere.
  • Makes the implementation a bit easier to read and maintain for contributors.
  • Reduces minor linting or style concerns 🛠️ without affecting functionality.
  • No expected user-facing impact 📌; this is a safe internal refactor/cleanup.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working fixed Bug has been resolved priority: low Low urgency; can wait behind higher-priority work. labels Jun 12, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @pderrenger, thank you for submitting a ultralytics/pre-commit 🚀 PR! This is an automated message to help streamline review, and an engineer will assist you soon 😊 Please review the checklist below to help ensure a smooth integration:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/pre-commit main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Clean PR. The diff only removes an unused inline assignment and reformats the existing re.sub() call without changing behavior. I did not find any actionable issues in the modified lines.

@glenn-jocher
glenn-jocher merged commit 705c6a5 into main Jun 12, 2026
4 checks passed
@glenn-jocher
glenn-jocher deleted the update-format-headers-redirects-20260612201348 branch June 12, 2026 20:38
@UltralyticsAssistant

Copy link
Copy Markdown
Member

Merged — nice cleanup, @pderrenger, and thanks @glenn-jocher for the collaboration.

As Leonardo da Vinci said, “Simplicity is the ultimate sophistication.” This small refactor is a great example of that: removing an unused inline assignment keeps capitalize_comments.py clearer and easier to maintain without changing behavior.

Appreciate the thoughtful contribution and continued attention to code quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixed Bug has been resolved priority: low Low urgency; can wait behind higher-priority work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants