Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files with UTF-16 encoding fail when running xstyler on Ubuntu #485

Open
mrlacey opened this issue Apr 9, 2024 · 0 comments
Open

Files with UTF-16 encoding fail when running xstyler on Ubuntu #485

mrlacey opened this issue Apr 9, 2024 · 0 comments

Comments

@mrlacey
Copy link
Contributor

mrlacey commented Apr 9, 2024

Describe the bug

UTF-16 encoded files fail a passive check from xstyler when run on Ubuntu (as part of a GitHub Action)

I'm working on a project where we need some files encoded as UTF16 (while most are encoded with UTF-8)

This is causing issues with our CI checks (that runs on a Ubuntu machine via GitHub Actions).

To Reproduce
Steps to reproduce the behavior:

  1. Create XAML file that is formatted to meet the standards defined in that settings file
  2. Verify (on Windows) that the file is formatted as expected/desired.
  3. Run XStyler.Console on a Ubuntu machine to check the same file using the --passive flag

Here's a repo I created that reproduces this: https://github.com/mrlacey/xamlstyler-encoding-bug

You can see the files all pass the GitHub action when run on Windows: https://github.com/mrlacey/xamlstyler-encoding-bug/actions/runs/8621842608/job/23631611557
But the UTF-16 encoded files fail on Ubuntu: https://github.com/mrlacey/xamlstyler-encoding-bug/actions/runs/8621842604/job/23631611559#step:5:37

Everything is the same in those actions apart from the machine they run on.

Expected behavior
A clear and concise description of what you expected to happen.

  1. Rules should be applied consistently across all platforms.
  2. All encodings should be supported "everywhere"
  3. The reason for a FAIL (as part of a passive check) should be provided. (Working out why this failure was happening was slow and frustrating.)

Screenshots
If applicable, add screenshots to help explain your problem.

External Configuration
If you are using an external configuration, please attach to help reproduce the issue.

Version Info (please complete the following information):

  • OS: Ubuntu (22.04.4)
  • Visual Studio: n/a
  • XAML Styler: Console 3.2404.2

Additional context

We're left with two Workarounds:

  1. Run the action on Windows (this is slower and more expensive)
  2. Exclude those files from the checks. (Although this means adding another process to create the list of files we want checking and that we really do still want those files to meet the defined formatting standards.)

I've also noticed that xstyler will change the encoding of files when it updates them. Is this deliberate? Should I open a separate issue for this?

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

No branches or pull requests

2 participants