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

feat(script): Automatically generate doc_url and severity from ToCs, documentations, and analyser outputs #4225

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

whisperity
Copy link
Member

Important

⛔ Blocked by #4207.

There were some existing scripts in /scripts/labels which generated labels (not just doc_url, but also severity, in some cases) from analyser-specific knowledge.
With the introduction of the label_tool in the previous patch #4207, it is logical to subsume these scripts to be part of that infrastructure, which is done in this patch.

This patch is partially a refactor and partially a fix, as the aforementioned scripts were mostly 3 years old and some ceased to work since, e.g., the generation of labels for Clang-related stuff failed to do anything because the XPath expressions inside were targeting things that are not as such in the current upstream.
The URL generation for Clang SA and Clang-Tidy previously could not do anything with checkers that did not have any labels prior, which is not the case anymore.

@whisperity whisperity added clang sa 🐉 The Clang Static Analyzer is a source code analysis tool that finds bugs in C-family programs. clang-tidy 🐉 clang-tidy is a clang-based C++ “linter” tool. config ⚙️ other-analyzer 💬 Analysers which CodeChecker offers only report conversion of, but no driving cppcheck 🐞 CppCheck is a static analysis tool for C++ code labels Apr 19, 2024
@whisperity whisperity added this to the release 6.25.0 milestone Apr 19, 2024
Automatically generate the `doc_url` labels for checkers for analysers
which we know how to do this.
(Currently implemented only for Clang SA and Clang-Tidy.)
This tooling does a single HTTP request to download a "Table of
Contents" (ToC) document and uses HTML DOM scraping to extract the list
of checkers and their corresponding documentation link.

There was existing prior work for this feature, but those scripts were
about 3 years old (introduced in 2021. Nov, commit
aa72dc0), and they ceased to properly
work.
For example, for _Clang-Tidy_, the contents of the ToC changed in a
way that the previously used XPath expression did not match anything
at all.
In addition, the previous work at `doc_url.py` (later renamed
`doc_url_generate.py`) only generated labels for the checkers that were
_already_ present in the configuration file, defeating the purpose of
using a script to determine new labels for checkers.

This version reintroduces an improved DOM scraping logic, and enables
generating `doc_url` for checkers that are not yet present in the
configuration file, all the while using the new `label_tool/` package
structure introduced in a previous commit.
Automatically generate the `severity` labels for checkers of analysers
which we know how to.
(Currently implemented only for the Clang diagnostic (warning) flags
exposed through Clang-Tidy.)

There was existing prior work for this feature, but that script was
about 3 years old (introduced in 2021. Nov, commit
8d1a7fe), and due to changes in the
DOM of Sphinx documents, ceased to work properly since.

This refactoring is smaller in scope than the `doc_url` generation that
was done in a previous commit, as the original `compiler_warnings.py`
script accurately generated severities (and `doc_url`s, for that matter)
for previously "unknown" "checkers" as well.
Considering that all previously developed label-generating tools are now
subsumed into the new `label_tool` package, the extra directory is unnecessary.
@whisperity whisperity force-pushed the refactor/script/label-generator-tooling branch from 87ad204 to 9fc110d Compare April 30, 2024 11:26
@whisperity whisperity added enhancement 🌟 refactoring 😡 ➡️ 🙂 Refactoring code. tools 🛠️ Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc. RDY-OnHold 🛑 Patch reviewed and ready, but don't merge due to having to merge a dependent patch first. labels Apr 30, 2024
@whisperity whisperity removed the RDY-OnHold 🛑 Patch reviewed and ready, but don't merge due to having to merge a dependent patch first. label May 9, 2024
@whisperity whisperity changed the base branch from master to release-v6.23 May 22, 2024 11:37
@whisperity whisperity changed the base branch from release-v6.23 to master May 22, 2024 11:37
@whisperity whisperity marked this pull request as ready for review May 22, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang sa 🐉 The Clang Static Analyzer is a source code analysis tool that finds bugs in C-family programs. clang-tidy 🐉 clang-tidy is a clang-based C++ “linter” tool. config ⚙️ cppcheck 🐞 CppCheck is a static analysis tool for C++ code enhancement 🌟 other-analyzer 💬 Analysers which CodeChecker offers only report conversion of, but no driving refactoring 😡 ➡️ 🙂 Refactoring code. tools 🛠️ Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant