Skip to main content

clang-html

A visualizer for LLVM's linting tool: clang-tidy.

Getting Started with pip

test

Install it:

python -m pip install clang-html

In your shell:

# Call it as python module
python -m clang_html [logfile.log] [-o clang.html] [-d list.html]

# Call it directly
clang-tidy-html [logfile.log] [-o clang.html] [-d list.html]

In your python terminal:

>>> from pathlib import Path
>>> from clang_html import clang_tidy_visualizer

>>> clang_tidy_visualizer(Path("examples/sample.log"))
2021-04-23 12:30:40,619 - clang_html.clang_visualizer -     INFO - Writing results to clang.html

Libraries

Prerequisites

Install Clang-Tidy to use for your C/C++ source files.

On your local Linux machine, installation is as easy as:

sudo apt install clang-tidy

You will need bash or some other terminal to execute the script. Download Python 3 or higher here.

When running clang-tidy on your files, be sure to pipe it into a new log file of checks:

clang-tidy -checks=* [filename.c] | tee [newfile.log]

If you are receiving the following error:

Error while trying to load a compilation database: Could not auto-detect compilation database for file "your_file.c" No compilation database found in /your/directory or any parent directory

Create a simple json file to be compiled into your project documented here.

Running the script locally

Clone or fork this repository to run the script on your native system.

The script takes in one file argument of a txt or log file with your outputted clang-tidy checks.

python -m clang_html [newfile.log] [-o clang.html] [-d list.html]

Example Output

Inside the same directory as clang_visualizer.py, you will find a new html file called 'clang.html'.

You can also specify your custom file name when calling the script with [-o, --out] other_name.html or clang_tidy_visualizer(Path("sample.log"), Path("clang.html")).

An example html output can be found here.

The highlighting functionality uses your local session storage, which will save your changes on exit.

Contributing

Feel free to create a pull request for any updates or fixes to this repository.

Versioning

This repository uses LLVM Clang for versioning. By default, the script uses the latest information presented on LLVM's official checks list. Earlier versions should have support for the vast majority of checks.

The -d --checks_dict_url command-line option can link to another version (e.g., find v14.0.0 checks with: https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html).

Authors

  • Austin Hale

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for clang-html 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clang-html 1.6.1
File Size Uploaded
clang-html-1.6.1.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clang-html 1.6.1
File Interpreter ABI Platform
clang_html-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / clang-html-1.6.1.tar.gz

Download URL clang-html-1.6.1.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f3dd5bb77e40d2e15040401c750a3cff3e286b2bb26303607bfb12995f15d491
BLAKE2b-256 checksum
How to use checksums
1b406b71f73c54268a5b09311cc674d77f80c938e95103c4375ad8bb9fcb7699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / clang_html-1.6.1-py3-none-any.whl

Download URL clang_html-1.6.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cc9fceb168b7b259ea44a0f08dff20e303e0e70df2589c6ddd3303dc76e9fb1
BLAKE2b-256 checksum
How to use checksums
6721c6bc9a08eb46633f8ae084892ccc350518cb4f744ab6198a42dfb687b774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files

1.5

3 release files

1.4.1

2 release files

1.4

2 release files

1.3.8

1 release file

1.3.7

2 release files

1.3.5

2 release files

1.3.4

1 release file

1.3.3

2 release files

1.3.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page