rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Fix `RemoveTrailingWhitespace` to preserve shebang lines

Open timtebeek opened this issue 2 months ago • 1 comments

Summary

  • Fix RemoveTrailingWhitespace recipe removing shebang lines from JavaScript files
  • Add COMPILATION_UNIT_PREFIX to the list of locations to skip when removing trailing whitespace
  • Add test case to verify shebang preservation in JavaScript files

Changes

  • RemoveTrailingWhitespaceVisitor.java: Skip COMPILATION_UNIT_PREFIX location to preserve shebangs and other file-level prefixes
  • RemoveTrailingWhitespaceTest.java (JavaScript): Add integration test for shebang preservation

Test plan

  • [x] New JavaScript integration test passes: RemoveTrailingWhitespaceTest.doNotRemoveShebang()

  • [x] All existing Java tests pass: RemoveTrailingWhitespaceTest

  • [x] Verified the fix resolves the issue described in #6274

  • Fixes #6274

🤖 Generated with Claude Code

timtebeek avatar Nov 10 '25 11:11 timtebeek

CI taking more than 1hr to run? Is it stuck or what's wrong with this?

greg-at-moderne avatar Nov 27 '25 14:11 greg-at-moderne