clang-tidy-html icon indicating copy to clipboard operation
clang-tidy-html copied to clipboard

Allow local mirror of https://clang.llvm.org/extra/clang-tidy/checks/list.html

Open JoevDubach opened this issue 1 year ago • 0 comments

I don't have a full implementation - this is just a idea for how clang_html could allow a safety valve for recurring SSL issues like https://github.com/austinbhale/clang-tidy-html/issues/17 , as well as hypothetical use cases where the build machine is disconnected from the internet.

I was able to fetch an apparently sufficient subset of the website via: wget -r -N -l 1 -k https://clang.llvm.org/extra/clang-tidy/checks/list.html ...then kept only the resulting "clang.llvm.org/extra/clang-tidy/checks" directory, which amounted to 3.5M of data.

clang_html could be changed to require requests-file: https://github.com/dashea/requests-file

Then find_checks_dict could be changed to allow a requests-file transport in addition to its existing TLSAdapter:

from requests_file import FileAdapter

def find_checks_dict(checks_dict_url: str):
    session = Session()
    session.mount('https://', TLSAdapter())
    session.mount('file://', FileAdapter())
    res = session.get(checks_dict_url)

...then I could use --checks_dict_url with a "file://" version of a local filename, or clang_html could provide a new command line option --checks_dict_file specifying a local filename that it could transform into a "file://" link with the pathlib as_uri feature, present in all versions of Python supported by clang_html:

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> pathlib.Path("D:\\work\\checks\\list.html").as_uri()
'file:///D:/work/checks/list.html'

JoevDubach avatar Jan 05 '23 23:01 JoevDubach