question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pre-commit requires system-installed dotnet

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Mar 30, 2022

which example?

0reactions
asottilecommented, Mar 30, 2022

yeah I guess it’s just weird that you would have reached for an option you didn’t need to solve a problem you didn’t have – I’ve added the selected values in #2315

Read more comments on GitHub >

github_iconTop Results From Across the Web

pre-commit
We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks...
Read more >
pre-commit requires preview sdk #1350 - dotnet/format - GitHub
Reproduce steps: Make sure there is no net6-preview sdk installed globally; Use following .pre-commit-config.yaml.
Read more >
Pre-commit hooks you must know - Towards Data Science
pre -commit hooks are a mechanism of the version control system git. They let you execute code right before the commit.
Read more >
Git pre-commit hook in Visual Studio 2022 - Stack Overflow
I'm trying to do some linting with dotnet format in a pre-commit hook in VS2022. The problem ...
Read more >
Embedding dotnet format in your development cycle
First, you need to install pre-commit (see here). After installed, create a file ".pre-commit-config.yaml" in the root folder. Add the following ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found