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

Windows swift-format Support (#213) #219

Closed
wants to merge 9 commits into from

Conversation

compnerd
Copy link
Contributor

This is an amalgamation of all the various changes which can be reviewed individually. This however should hopefully repair #213.

Add support to the CI to test the swift-format (official) based linting
on Windows.
Ignore any swap files written out by vim.  This helps anyone who may use
vim as an editor.
This new function is similar to `run` except that it requires that the
arguments be passed properly quoted and pre-split through an array.  It
also will not permit the prefixing a command for execution.  The major
difference between `run` and `execute` is that `execute` will not go
through a shell, so parameter expansion, variable substitution, etc do
not occur.  Additionally, because there is no shell involved, a single
process is created rather than two processes (one for the shell, and the
actual process being invoked).  This is required to enable using this
action on Windows, where the process redirection does not work as the
shell used is different.
Use the newly minted `execute` to directly execute the `git` process.
This should be a slight bit faster as no new shell process needs to be
setup.
This adds a second path of execution specifically for Windows.  The
second path is required due to changes in how the action can be used.
In particular:

- `prefix` cannot be supported as we do not go through a shell
- `args` is currently unsupported as the style must be different

In order to regain the ability add supplementary arguments with execute,
the `args` parameter must change from a string to an array of strings.
`cat` is a common utility on Unix systems, however, it is not
universally available.  On Windows systems, resort to `cmd` (%COMSPEC%)
as the shell interpreter is guaranteed to be present.  It stands to
reason that `sh` would be a viable alternative to `cat` as that is the
default (POSIX) shell interpreter on Unix systems and should be present
on any SuS or POSIX complaint system.
This removes the trailing `,` to allow the warnings to be listed
similarly.  This is purely a stylistic change intended to help simplify
future changes.
When testing on Windows, the tool currently prints paths with a `/` path
separator rather than the canonical `\` separator for the platform.  The
resulting path is valid and usable.  However, this causes match failures
due to the difference in the path separator.  The `slash` module permits
us to normalize the path for the tests.  This should have no impact when
running on Unix platforms, but allows greater portability to Windows.
Add a dependency on slash for development purposes.
@compnerd compnerd marked this pull request as draft May 10, 2021 01:34
@github-actions
Copy link
Contributor

Thank you for your contribution to this project!

A stale label has been added to this pull request because it has been open 45 days with no activity. To keep this PR open, add a comment or push a commit within 10 days.

@github-actions github-actions bot added the stale label Jun 24, 2021
@github-actions github-actions bot closed this Jul 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant