pre-commit-ci / issues

public issues for https://pre-commit.ci
16 stars 3 forks source link

Executable `xxx` not found #108

Closed PointKernel closed 2 years ago

PointKernel commented 2 years ago

I'm setting up my first pre-commit.ci so apologies if I missed something obvious. To perform auto-formatting via clang-format, I got the error below:

clang-format.............................................................Failed
- hook id: clang-format
- exit code: 1

Executable `clang-format` not found

Here is my configuration file:

repos:
      - repo: https://github.com/pre-commit/mirrors-clang-format
        rev: v11.1.0
        hooks:
              - id: clang-format
                name: clang-format
                description: Format files with ClangFormat.
                entry: clang-format
                language: system
                files: \.(cu|cuh|h|hpp|cpp|inl)$
                'types_or': [file]
                args: ['-fallback-style=none', '-style=file', '-i']

default_language_version:
      python: python3

Not sure it's a problem of mirrors-clang-format or pre-commit.ci. More details can be found at https://github.com/PointKernel/toto-cuda/pull/1/.

Any ideas on how to fix this issue? Thanks!

asottile commented 2 years ago

idk where you got all of this but it's all wrong and it's what is causing your problem -- remove that: https://github.com/PointKernel/toto-cuda/pull/1/files#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9R6-R17

the usage from the README is here -- if you follow that it works fine: https://github.com/pre-commit/mirrors-clang-format#using-clang-format-with-pre-commit

PointKernel commented 2 years ago

The README example won't check all target files in my case. So I still need these two lines:

               files: \.(cu|cuh|h|hpp|cpp|inl)$
               'types_or': [file]

to check e.g. .cu and .inl files.