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

Support passing clang version #14

Closed
shenxianpeng opened this issue Jun 4, 2023 · 1 comment
Closed

Support passing clang version #14

shenxianpeng opened this issue Jun 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@shenxianpeng
Copy link
Collaborator

Because clang-tools already support passing clang version, this hook should also support it.

  1. I need to test first.
  2. Also add test to testing forlder
@shenxianpeng shenxianpeng added dependencies Pull requests that update a dependency file enhancement New feature or request and removed dependencies Pull requests that update a dependency file labels Jun 4, 2023
@shenxianpeng
Copy link
Collaborator Author

shenxianpeng commented Jun 9, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant