Skip to content

Use the clang-tidy version in use for check documentation links - #14830

Open
Abdelhadi Salmaoui (abdelhadi703) wants to merge 1 commit into
microsoft:mainfrom
abdelhadi703:fix/clang-tidy-doc-version
Open

Abdelhadi Salmaoui (abdelhadi703) wants to merge 1 commit into
microsoft:mainfrom
abdelhadi703:fix/clang-tidy-doc-version

Conversation

@abdelhadi703

Copy link
Copy Markdown

Every clang-tidy diagnostic carries a link to the documentation of the check, and that link is built from a hardcoded LLVM release (currently 23.1.0). A check that only exists in a newer clang-tidy therefore gets a dead link. #12804 reported exactly this after moving from clang-tidy 18 to 19 and seeing the link stuck on the 18.1.6 page.

settings.ts already works out which clang-tidy will be used -- the bundled one or the one found on PATH -- and compares their versions, but it discarded the version afterwards. I keep it cached next to the clang-tidy path and read it back when the link is built, so the URL points at the release the running binary actually comes from. When the version could not be determined (the user set codeAnalysis.clangTidy.path explicitly, or the binary could not be executed), the link falls back to the bundled release, i.e. the previous behaviour.

The thread also mentions the version-independent documentation URLs, and that is a fair alternative -- it takes the version out of the URL for good. I went with the version in use because that is what the issue title asks for, and because the version-less page always describes the newest release: for someone on an older clang-tidy it links to checks their binary does not have, which is the same kind of mismatch in the other direction. That is a judgement call rather than a certainty, so say the word if you prefer the version-less URL -- it is a much smaller change than this one.

The URL construction now lives in LanguageServer/clangTidyDocumentation.ts and is covered by test/unit/clangTidyDocumentation.test.ts: version in use, no version, and a malformed version. It runs with the other unit tests through yarn test. I also ran those cases directly in node, since the extension test harness installs its packages from the private Azure feed and I don't have access to it here. CHANGELOG has an entry.

Fixes #12804.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

Links to docs for clang-tidy checks are for the bundled version instead of the used version.

1 participant