Support passing clang version
shenxianpeng opened this issue · 1 comments
shenxianpeng commented
Because clang-tools already support passing clang version, this hook should also support it.
- I need to test first.
- Also add test to testing forlder
shenxianpeng commented
Specific clang version see does not work, need to check
repos:
- repo: https://github.com/cpp-linter/cpp-linter-hooks
rev:
hooks:
- id: clang-format
args: [--style=file, --version=15] # to load .clang-format
- id: clang-tidy
args: [--checks=.clang-tidy, --version=15] # path/to/.clang-tidy
[WARNING] Creating temporary repo with uncommitted changes...
[INFO] Initializing environment for /tmp/tmpka5lx9dp/shadow-repo.
===============================================================================
Using config:
===============================================================================
repos:
- repo: /tmp/tmpka5lx9dp/shadow-repo
rev: 61437ab66fa4e12b3a60e94965c3bb302ca2baa0
hooks:
- id: clang-format
- id: clang-tidy
===============================================================================
[INFO] Installing environment for /tmp/tmpka5lx9dp/shadow-repo.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
clang-format.............................................................Passed
clang-tidy...............................................................Failed
- hook id: clang-tidy
- exit code: 1
425 warnings and 1 error generated.
Error while processing /home/repos/cpp-linter-hooks/testing/main.c.
Suppressed 424 warnings (424 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
/home/repos/cpp-linter-hooks/testing/main.c:4:13: warning: statement should be inside braces [readability-braces-around-statements]
for (;;)
^
{
/usr/include/stdio.h:33:10: error: 'stddef.h' file not found [clang-diagnostic-error]
#include <stddef.h>
^~~~~~~~~~
$ which clang-format
~/.local/bin/clang-format
$ clang-format --version
clang-format version 13.0.0