cpp-linter-action
cpp-linter-action copied to clipboard
Improve paths handling
First of all, great Action!
I noticed that when setting an absolute path to the compilation database I receive wrong paths.
- name: Run clang-tidy and clang-format
uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
database: ${{github.workspace}}/out/build/${{matrix.arch}}-${{env.BUILD_TYPE}}
thread-comments: true
step-summary: true
Produces "D:\a\figures-counter\figures-counter\afigures-counterfigures-counter\out\build\x64-debug"
instead of the correct path "D:\a\figures-counter\figures-counter\out\build\x64-debug"
The workaround is to omit the prefix and use relative path
database: out/build/${{matrix.arch}}-${{env.BUILD_TYPE}}
I think what's happening here might be related to using a Windows runner. The var github.workspace
lost all it path delimiters: afigures-counterfigures-counter
. This makes me wonder what stripped them. Typically python strings with \
have to be doubled (\\
) to escape the misinterpreted reg-exp token. Otherwise you'd get strings with tokens like \a
that mean "literal a".
What perplexes me more is that drive letter D:
was stripped as well. I think I have the details to reproduce, and hopefully I can find a fix for this.
Paths on windows will be passed to cpp-linter's python package using powershell in the next release. I still have to do a little more testing to make sure clang-tidy can actually find the database on Windows runners where the database
option is given an absolute path.