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

current pre-commit configuration does not working on windows clients #148

Closed
mp-se opened this issue Dec 25, 2021 · 5 comments
Closed

current pre-commit configuration does not working on windows clients #148

mp-se opened this issue Dec 25, 2021 · 5 comments

Comments

@mp-se
Copy link
Contributor

mp-se commented Dec 25, 2021

The precommit yaml addons does not work on windows, see issues;

adrienverge/yamllint#347
jumanjihouse/pre-commit-hook-yamlfmt#25

If you want people to contribute when using Windows as a client i suggest a change of plugins for pre-commit...

These are the errors shown in vscode;

yamlint:
Traceback (most recent call last):
File "C:\users\magnu\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
exec(code, run_globals)
File "C:\Users\magnu.cache\pre-commit\repo49jpfjdz\py_env-python3.9\Scripts\yamllint.EXE_main
.py", line 7, in
File "C:\Users\magnu.cache\pre-commit\repo49jpfjdz\py_env-python3.9\lib\site-packages\yamllint\cli.py", line 206, in run
problems = linter.run(f, conf, filepath)
File "C:\Users\magnu.cache\pre-commit\repo49jpfjdz\py_env-python3.9\lib\site-packages\yamllint\linter.py", line 240, in run
content = input.read()
File "C:\users\magnu\appdata\local\programs\python\python39\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 131: character maps to

yamlfmt
Format YAML files........................................................Failed

  • hook id: yamlfmt
  • exit code: 1

Executable C:Usersmagnu.cachepre-commitrepotor08tibpy_env-python3.9Scriptspython.EXE not found

@mp-se mp-se added the bug label Dec 25, 2021
@CM000n
Copy link
Collaborator

CM000n commented Dec 25, 2021

But it's completely optional, you don't have to use pre-commit. It's just a help and a way for us to keep the code consistent.

To be honest, it will probably be difficult to find other suitable pre-commit hooks. Most development work, except of course for Windows itself, tends to be done on Unix-like systems like MacOS or Linux.

@mp-se
Copy link
Contributor Author

mp-se commented Dec 25, 2021

I understand its optional. But its hard to send in a PR without proper formattting (which i experieced) since it will be blocked. From the issue reports I understand that these issues would be hard to fix (one of them have been open for one year).

I can have a look and see if I can find something that would work on windows that gives the simiar result or we should add a description on what formatting is expected before submitting a PR.

I just wanted to report this if other users experience the same issues.

@CM000n
Copy link
Collaborator

CM000n commented Dec 25, 2021

I understand that. But after sending the merge request you will get a detailed log, what to adjust if necessary. And we are always ready to help with the adjustments. Just as we have already done.

Of course we would appreciate it if you find pre-commit hooks with the same functionality that can run multiplatform.

In any case, a good idea to record this here in case someone else encounters this problem.

@CM000n CM000n pinned this issue Dec 25, 2021
@CM000n CM000n added enhancement and removed bug labels Dec 25, 2021
@mp-se
Copy link
Contributor Author

mp-se commented Dec 25, 2021

A workaround on Windows is to run git and pre-commit from WSL2 (Windows Subsystem for Linux) this approach works fine and is supported by VSCode on Windows.

I suggest this is kept for information (or documented in wiki). It's ok to mark this bug as "won't fix".

@CM000n
Copy link
Collaborator

CM000n commented Dec 25, 2021

Yes, that's exactly the way I use it too.😊
I only have Win11 notebooks here and use fedora under WSL2 for development work on them or develop directly via SSH on my home server, which runs Debian.

@CM000n CM000n added the wontfix label Dec 25, 2021
@CM000n CM000n changed the title precommit does not work with selected plugins on windows clients current pre-commit configuration does not working on windows clients Dec 25, 2021
@schumijo schumijo unpinned this issue Dec 28, 2021
@mp-se mp-se closed this as not planned Won't fix, can't repro, duplicate, stale Oct 26, 2023
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