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

Workflow Fails if Path provided in "Source" input contains whitespace #62

Closed
rjwignar opened this issue Dec 7, 2023 · 0 comments · Fixed by #63
Closed

Workflow Fails if Path provided in "Source" input contains whitespace #62

rjwignar opened this issue Dec 7, 2023 · 0 comments · Fixed by #63

Comments

@rjwignar
Copy link
Contributor

rjwignar commented Dec 7, 2023

Problem

Like a few others, I pair clang-format-lint with tj-actions/changed-files to pass a list of modified files to clang-format-lint.
This pairing works great. However, I've noticed the workflow fails when a filepath contains whitespaces:
image.

I've been able to trace this bug back to PR #14 which acknowledges the limitation

Details

In the screenshot provided above, the files argument:

"features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/CRPM.hlsli features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli src/Features/DistantTreeLighting.cpp src/Features/DistantTreeLighting.h"

Becomes split by split_list_arg() into:

'features/Complex',
'Parallax',
'Materials/Shaders/ComplexParallaxMaterials/CRPM.hlsli',
'features/Complex',
'Parallax',
'Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli',
'src/Features/DistantTreeLighting.cpp src/Features/DistantTreeLighting.h'

Possible Solution

I believe this can be solved by extending split_list_arg() to properly parse directories containing whitespaces.
If the whitespaces are escaped using backward slashes, e.g
features/Complex\ Parallax\ Materials/Shaders/ComplexParallaxMaterials/CRPM.hlsli
instead of

features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/CRPM.hlsli

...then split_list_arg() can be extended to split the whole paths by whitespaces while preserving these filepaths.

I've already made modifications to run-clang-format.py that should achieve this. I'll have a PR ready in a bit.

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 a pull request may close this issue.

1 participant