# clang-html
A visualizer for LLVM's linting tool: clang-tidy.
## Getting Started with pip
![test](https://static.pepy.tech/personalized-badge/clang-html?period=total&units=international_system&left_color=black&right_color=blue&left_text=Downloads)
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
- [argparse](https://pypi.org/project/argparse/)
- [beautifulsoup4](https://pypi.org/project/beautifulsoup4/)
- [certifi](https://pypi.org/project/certifi/)
- [lxml](https://pypi.org/project/lxml/)
### Prerequisites
Install [Clang-Tidy](http://clang.llvm.org/extra/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](https://www.python.org/downloads/).
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](http://clang.llvm.org/docs/JSONCompilationDatabase.html).
## 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](https://austinbhale.com/clang-tidy-html/examples/clang.html).
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](http://clang.llvm.org/extra/clang-tidy/index.html) for versioning. By default, the script uses the latest information presented on LLVM's official [checks list](http://clang.llvm.org/extra/clang-tidy/checks/list.html). 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](https://github.com/austinbhale/Clang-Visualizer/graphs/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/austinbhale/Clang-Visualizer/LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/austinbhale/Clang-Visualizer",
"name": "clang-html",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6, <4",
"maintainer_email": "",
"keywords": "clang,clang-tidy,html",
"author": "Austin Hale",
"author_email": "ah@unc.edu",
"download_url": "https://files.pythonhosted.org/packages/1b/40/6b71f73c54268a5b09311cc674d77f80c938e95103c4375ad8bb9fcb7699/clang-html-1.6.1.tar.gz",
"platform": null,
"description": "# clang-html\r\nA visualizer for LLVM's linting tool: clang-tidy.\r\n\r\n## Getting Started with pip\r\n![test](https://static.pepy.tech/personalized-badge/clang-html?period=total&units=international_system&left_color=black&right_color=blue&left_text=Downloads)\r\n\r\nInstall it:\r\n```\r\npython -m pip install clang-html\r\n```\r\nIn your shell:\r\n```\r\n# Call it as python module\r\npython -m clang_html [logfile.log] [-o clang.html] [-d list.html]\r\n\r\n# Call it directly\r\nclang-tidy-html [logfile.log] [-o clang.html] [-d list.html]\r\n```\r\n\r\nIn your python terminal:\r\n```\r\n>>> from pathlib import Path\r\n>>> from clang_html import clang_tidy_visualizer\r\n\r\n>>> clang_tidy_visualizer(Path(\"examples/sample.log\"))\r\n2021-04-23 12:30:40,619 - clang_html.clang_visualizer - INFO - Writing results to clang.html\r\n```\r\n\r\n### Libraries\r\n- [argparse](https://pypi.org/project/argparse/)\r\n- [beautifulsoup4](https://pypi.org/project/beautifulsoup4/)\r\n- [certifi](https://pypi.org/project/certifi/)\r\n- [lxml](https://pypi.org/project/lxml/)\r\n\r\n### Prerequisites\r\n\r\nInstall [Clang-Tidy](http://clang.llvm.org/extra/clang-tidy/) to use for your C/C++ source files.\r\n\r\nOn your local Linux machine, installation is as easy as:\r\n\r\n```\r\nsudo apt install clang-tidy\r\n```\r\n\r\nYou will need bash or some other terminal to execute the script. Download Python 3 or higher [here](https://www.python.org/downloads/).\r\n\r\nWhen running clang-tidy on your files, be sure to pipe it into a new log file of checks:\r\n\r\n```\r\nclang-tidy -checks=* [filename.c] | tee [newfile.log]\r\n```\r\n\r\nIf you are receiving the following error:\r\n\r\n> Error while trying to load a compilation database:\r\n> Could not auto-detect compilation database for file \"your_file.c\"\r\n> No compilation database found in /your/directory or any parent directory\r\n\r\nCreate a simple json file to be compiled into your project documented [here](http://clang.llvm.org/docs/JSONCompilationDatabase.html).\r\n\r\n## Running the script locally\r\n\r\nClone or fork this repository to run the script on your native system.\r\n\r\nThe script takes in one file argument of a txt or log file with your outputted clang-tidy checks.\r\n\r\n```\r\npython -m clang_html [newfile.log] [-o clang.html] [-d list.html]\r\n```\r\n\r\n## Example Output\r\n\r\nInside the same directory as clang_visualizer.py, you will find a new html file called 'clang.html'.\r\n\r\nYou 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\"))`.\r\n\r\nAn example html output can be found [here](https://austinbhale.com/clang-tidy-html/examples/clang.html).\r\n\r\nThe highlighting functionality uses your local session storage, which will save your changes on exit.\r\n\r\n## Contributing\r\n\r\nFeel free to create a pull request for any updates or fixes to this repository.\r\n\r\n## Versioning\r\n\r\nThis repository uses [LLVM Clang](http://clang.llvm.org/extra/clang-tidy/index.html) for versioning. By default, the script uses the latest information presented on LLVM's official [checks list](http://clang.llvm.org/extra/clang-tidy/checks/list.html). Earlier versions should have support for the vast majority of checks.\r\n\r\nThe `-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).\r\n\r\n## Authors\r\n\r\n- **Austin Hale**\r\n\r\nSee also the list of [contributors](https://github.com/austinbhale/Clang-Visualizer/graphs/contributors) who participated in this project.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/austinbhale/Clang-Visualizer/LICENSE) file for details.\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Generates an html file that organizes your clang-tidy log output with the latest clang-tidy checks.",
"version": "1.6.1",
"split_keywords": [
"clang",
"clang-tidy",
"html"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "ba36931ab93835ecfdb2cca57f5d8fc4",
"sha256": "2cc9fceb168b7b259ea44a0f08dff20e303e0e70df2589c6ddd3303dc76e9fb1"
},
"downloads": -1,
"filename": "clang_html-1.6.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba36931ab93835ecfdb2cca57f5d8fc4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6, <4",
"size": 14915,
"upload_time": "2022-12-26T23:06:18",
"upload_time_iso_8601": "2022-12-26T23:06:18.422430Z",
"url": "https://files.pythonhosted.org/packages/67/21/c6bc9a08eb46633f8ae084892ccc350518cb4f744ab6198a42dfb687b774/clang_html-1.6.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "9f247feb3c7be2092e01b0fa640925e9",
"sha256": "f3dd5bb77e40d2e15040401c750a3cff3e286b2bb26303607bfb12995f15d491"
},
"downloads": -1,
"filename": "clang-html-1.6.1.tar.gz",
"has_sig": false,
"md5_digest": "9f247feb3c7be2092e01b0fa640925e9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6, <4",
"size": 15728,
"upload_time": "2022-12-26T23:06:20",
"upload_time_iso_8601": "2022-12-26T23:06:20.071044Z",
"url": "https://files.pythonhosted.org/packages/1b/40/6b71f73c54268a5b09311cc674d77f80c938e95103c4375ad8bb9fcb7699/clang-html-1.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-26 23:06:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "austinbhale",
"github_project": "Clang-Visualizer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "clang-html"
}