Skip to content

pre-commit requires system-installed dotnet #2314

@Walluce

Description

@Walluce

describe your issue

I was trying to write a commit-msg hook in dotnet and got this error:

AssertionError: For now, pre-commit requires system-installed dotnet

pre-commit --version

2.17.0

.pre-commit-config.yaml

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: c:\Dev\checkov\hook\my-hook
    rev: v1.0.1
    hooks:
    -   id: my-hook
        stages: [commit-msg]

default_language_version:
    dotnet: dotnet

default_stages: [commit, push, post-merge, post-checkout]
#fail_fast: true

Execution:

pre-commit run --verbose --commit-msg-filename .\msg.txt --hook-stage commit-msg my-hook

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 2.17.0
git --version: git version 2.29.0.windows.1
sys.version:
    3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)]
sys.executable: C:\Users\user1p\AppData\Local\Programs\Python\Python310\python.exe
os.name: nt
sys.platform: win32

error information

An unexpected error has occurred: AssertionError: For now, pre-commit requires system-installed dotnet
Traceback (most recent call last):
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\error_handler.py", line 70, in error_handler
    yield
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\main.py", line 396, in main
    return run(args.config, store, args)
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\commands\run.py", line 416, in run
    install_hook_envs(to_install, store)
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\repository.py", line 224, in install_hook_envs
    _hook_install(hook)
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\repository.py", line 82, in _hook_install
    lang.install_environment(
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\languages\dotnet.py", line 42, in install_environment
    helpers.assert_version_default('dotnet', version)
  File "C:\Users\user1p\AppData\Local\Programs\Python\Python310\lib\site-packages\pre_commit\languages\helpers.py", line 70, in assert_version_default
    raise AssertionError(
AssertionError: For now, pre-commit requires system-installed dotnet

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions