Skip to content

feat: prefixes and regexes#1

Open
quasariumm wants to merge 8 commits intomainfrom
prefixes-and-regexes
Open

feat: prefixes and regexes#1
quasariumm wants to merge 8 commits intomainfrom
prefixes-and-regexes

Conversation

@quasariumm
Copy link
Collaborator

@quasariumm quasariumm commented Feb 15, 2026

What

Adds clang-tidy prefixes to cpp-linter-hooks through the following two arguments added to the clang-tidy hook:

  • --clang-tool-prefix: Specifies a prefix for the clang-tidy tool.
  • --prefix-regex: Specifies a regex to use for the previously specified prefix

Both arguments can be called multiple times to make it more useful for projects that require the use of several specific clang-tidy toolchains.

As a safety measure, no more regexes may be defined than prefixes and no more than two more prefixes may be defined than there are regexes.

Reviewer checklist

  • Install pre-commit (pip install pre-commit)
  • Add the supplement config file to any repo you want to test it on
  • Set your working directory to the test repository's root
  • Include a change that you know clang-tidy will give an error for
  • Install the hook to the repository (python -m pre_commit install)
  • Run pre-commit on all files (python -m pre_commit run --all-files)
  • Check if the hook picks up the introduced linting error

Note

The arguments are not added to the clang-format hook since from testing the non-prefixed tool gives the same result as ones with a prefix.

Supplement: .pre-commit-config.yaml

Replace 'REPLACE_ME' with the prefix you want to test and 'DB_PATH' with the path that compile_commands.json is in.

repos:
  - repo: https://github.com/BredaUniversityGames/cpp-linter-hooks
    rev: 8561964
    hooks:
      - id: clang-format
        args:
          - '--style=file'
          - '--version=19'

      - id: clang-tidy
        args:
          - '--version=19'
          - '-p=DB_PATH'
          - '--clang-tool-prefix=REPLACE_ME'
          - '--prefix-regex=.*REPLACE_ME.*'

@quasariumm quasariumm self-assigned this Feb 15, 2026
@quasariumm quasariumm requested a review from Quartenia February 15, 2026 13:20
@quasariumm quasariumm added the enhancement New feature or request label Feb 15, 2026
@quasariumm quasariumm changed the title Prefixes and regexes feat: prefixes and regexes Feb 15, 2026
Copy link
Member

@Quartenia Quartenia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works fine on the Vroom repository, if you want me to also test it in bee it would take a bit longer :)

I am no sure if that's intended but i removed const from a platform file and it was not picked up by the hook, i sent it in dm

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

Successfully merging this pull request may close these issues.

2 participants