JohnnyMorganz / StyLua

A Lua code formatter
Mozilla Public License 2.0
1.6k stars 72 forks source link

CLI overrides not applied when formatting files in v2.0.0 #925

Closed dubalda closed 1 hour ago

dubalda commented 2 hours ago

I tried to run it both from Windows and from Docker for Windows

stylua.exe --line-endings Windows --check .

stylua.exe --line-endings Unix --check .

The result is the same, it gives errors in all files. Example of the first two files

Diff in ./cloud_test_tasks/runTests.luau:
1        |-require(game.ReplicatedStorage.Shared.LuTestRoblox.LuTestRunner)
    1    |+require(game.ReplicatedStorage.Shared.LuTestRoblox.LuTestRunner)
Diff in ./place_battle/replicated_storage/tests/test_workspace.luau:
1        |-local tests = {}
2        |-local Workspace = game:GetService("Workspace")
3        |-
4        |-function tests.test_server_workspace_gravity()
5        |-    assert(math.floor(Workspace.Gravity) == 196, "Gravity value is: " .. Workspace.Gravity)
6        |-end
7        |-
8        |-return tests
    1    |+local tests = {}
    2    |+local Workspace = game:GetService("Workspace")
    3    |+
    4    |+function tests.test_server_workspace_gravity()
    5    |+    assert(math.floor(Workspace.Gravity) == 196, "Gravity value is: " .. Workspace.Gravity)
    6    |+end
    7    |+
    8    |+return tests
Diff in ./place_battle/replicated_storage/tests/test_starterplayer.luau:

After reverting to 0.20.0 the results became normal again

JohnnyMorganz commented 1 hour ago

Hm, this does look like line endings changing for some reason. Which is weird, since I don't think we touched that at all.

Do you by any chance have an example file I can test this with? Either in a public repo, or attaching a code file here (not in a code block since we need to preserve the line endings)

dubalda commented 1 hour ago

Yes, sure

runTests.zip