Skip to content

fix(.editorconfig/.gitattributes/scripts): doc accuracy + missing shebang + missing eol=lf#350

Closed
Chris-Wolfgang wants to merge 2 commits into
mainfrom
fix/editorconfig-gitattributes-shebang-cleanup
Closed

fix(.editorconfig/.gitattributes/scripts): doc accuracy + missing shebang + missing eol=lf#350
Chris-Wolfgang wants to merge 2 commits into
mainfrom
fix/editorconfig-gitattributes-shebang-cleanup

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

Three small canonical fixes flagged by Copilot review on a downstream sync (Try-Pattern PR #109).

Changes

.editorconfig

The PowerShell section had:

[*.ps1]
indent_size = 4

The global [*] section already sets indent_size = 4, so the override was redundant. The accompanying comment claimed an override was "needed" — wasn't true. Dropped the section entirely; reworded the comment to say PowerShell inherits everything from [*].

.gitattributes

Two issues with the *.ps1 rule:

  1. The comment claimed "LF line endings, no BOM" — but .gitattributes can only enforce EOL, not byte-order marks. BOM is an encoding concern handled by .editorconfig's global charset = utf-8. Reworded to clarify.

  2. The actual rule was just *.ps1 text — no eol=lf. So despite the LF comment, the LF wasn't actually being enforced; users with autocrlf=true would still get CRLF in the index. Added eol=lf.

scripts/Setup-Labels.ps1

Was missing the #!/usr/bin/env pwsh shebang. The other 4 scripts in scripts/ all have it, and both .editorconfig and .gitattributes comments reference "every script in scripts/" having a shebang — bringing reality in line with documentation.

Note about the protected-files guard

This PR touches .editorconfig so the Detect .NET Projects guard will fail it. Maintainer override required.

Cascade

After this lands, downstream sync PRs (like Try-Pattern #109, which already mirrors these fixes manually) won't keep re-introducing the inaccurate comments / missing shebang.

Test plan

  • Maintainer override + merge
  • Verify next downstream chore: sync from canonical doesn't reintroduce the issues

Chris-Wolfgang and others added 2 commits May 9, 2026 21:10
Two follow-ups to the hardening landed in #345 (review comments on
ETL-FixedWidth#88):

- Wrap the deploy step body in try { ... } finally { ... } so the
  http.extraheader unset always runs. Previously, any early `exit 1`
  path (failed ls-remote, missing version-picker template) would
  leave the encoded token in the runner's global git config for the
  remaining steps in the job.

- Replace `$global:LASTEXITCODE = $deployExitCode` with explicit
  `if ($deployExitCode -ne 0) { exit $deployExitCode }` after the
  finally. PowerShell does not reliably surface a script block's
  $LASTEXITCODE as the step exit code (especially when the final
  statement is an assignment), so a failed `git commit` / `git push`
  was being reported as step success.

Default $useWorktree to $false before the try block so the cleanup
path picks the safe Remove-Item branch if the try fails before the
ls-remote check assigns it.
…bang + missing eol=lf

Three small canonical fixes flagged by Copilot review on a downstream
sync (Try-Pattern PR #109):

- .editorconfig: drop the redundant [*.ps1] indent_size = 4 block
  (the global [*] section already sets indent_size = 4) and reword
  the comment so it doesn't claim an override is 'needed'.

- .gitattributes: clarify in the *.ps1 comment that only EOL is
  enforced here. BOM-free encoding is handled by .editorconfig's
  global charset = utf-8 setting, not by .gitattributes (which has
  no ability to control byte-order marks). Also add the missing
  eol=lf attribute — previously the rule was just '*.ps1 text', so
  the LF claim in the comment wasn't actually being enforced; users
  with autocrlf=true would still get CRLF in the index.

- scripts/Setup-Labels.ps1: add the missing #!/usr/bin/env pwsh
  shebang. The other 4 scripts in scripts/ all have it, and the
  comments in .editorconfig + .gitattributes both reference 'every
  script in scripts/' having a shebang — bringing reality in line
  with the documentation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Chris-Wolfgang

Copy link
Copy Markdown
Owner Author

Closing — branch is stale. Three other PRs landed in parallel (#347 + #348 covering most of the .editorconfig/.gitattributes work, plus an unnumbered direct-commit 10077b7 covering the docfx.yaml resilience fixes from issue #351 #2 and #3). My branch's docfx.yaml is the older version, so leaving this open would revert that work. Will open a minimal replacement covering the residual three items: (a) drop redundant [*.ps1] indent_size = 4 block, (b) reword .gitattributes to clarify BOM is .editorconfig's concern, (c) add missing shebang to Setup-Labels.ps1.

@Chris-Wolfgang Chris-Wolfgang deleted the fix/editorconfig-gitattributes-shebang-cleanup branch May 10, 2026 01:43
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.

1 participant