-
Notifications
You must be signed in to change notification settings - Fork 24
Description
This is a small feature request to add the capability to act against different files for clang-tidy and clang-format in the same job.
Motivation
In the C++ project I am using this action against, we sometimes separate out the declaration of templates (e.g. a MyTemplateClass.hpp file) and implementations of these templates (e.g. MyTemplateClass.impl.hpp). The .impl.hpp files shouldn't be linted on their own as they only make sense when included directly in the template declaration file and they contain an include guard to that effect such as
#ifndef MYTEMPLATECLASS_HPP_ #error "This file should only be included through MyTemplateClass.hpp" #endif #ifndef MYTEMPLATECLASS_IMPL_HPP_ #define MYTEMPLATECLASS_IMPL_HPP_ <implementation code here> #endif
This leads to cpp-linter reporting errors such as
/path/to/MyTemplateClass.impl.hpp:x:y: error: no template named 'MyTemplateClass' [clang-diagnostic-error]
x | inline MyTemplateClass<T>::foo(
|
which I'd like to avoid.
Other options I've considered to get around this:
- Explicitly passing all
.impl.hppheader files to theignoreargument: I would then miss all warnings from these files which I'd like to see. - Renaming the extensions of template implementation files to
.ippso that cpp-linter doesn't act on them (assuming I didn't add this to theextensionsargument): this would mean their formatting is not checked either. - Running separate jobs for clang-format and clang-tidy and doing the above: I think this would work but it seems a little wasteful and I quite like the fact I can do both formatting and linting in 1 job with this action.
I'm open to other suggestions if there's already a way to get around the issue I describe that I haven't thought of.