claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Refactoring python code, Claude has issues with indenting using these tool-based edits

Open walt93 opened this issue 6 months ago • 4 comments

Environment

  • Platform (select one):
    • [X] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: 1.0.34 (Claude Code)
  • Operating System: macOS 15.3,
  • Terminal: IntelJIdea

Bug Description

Refactoring python code, you have to watch Claude like a hawk. Test everything. EVERYTHING.

Issue: finding random blocks of code that are at the wrong indentation level after a refactoring.

Steps to Reproduce

  1. Write a ton of python code
  2. Have Claude work in it using tool based edits
  3. Hilarity ensues

Expected Behavior

Indentation at the expected level

Actual Behavior

Wild and zany adventures debugging white space

walt93 avatar Jun 27 '25 00:06 walt93

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5278
  2. https://github.com/anthropics/claude-code/issues/2707

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 16 '25 06:08 github-actions[bot]

Neither of those are a duplicate: this issue relates to indentation at the beginning of lines, whereas those relate to superfluous trailing whitespace at the end of lines and a missing newline at EOF.

aspiers avatar Aug 17 '25 17:08 aspiers

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 05 '25 10:12 github-actions[bot]

Still an issue.

aspiers avatar Dec 10 '25 22:12 aspiers