Parses compilers' outputs to retrieve warnings
Project description
warnings-parser
Library to transform an output from a compiler to a dict to be easily output it in a json format.
It supports any compilers using the standard file_path:line:column: warning: message [category] format such as:
- gcc
- clang
- clang-tidy
- cppcheck with
--template='{file}:{line}:{column}: warning: {message} [{id}]'
Install
pip install warning-parser
Usage
usage example to generate bitbucket annotations:
from warning_parser import get_warnings
warnings = get_warnings("/path/to/gcc_output.txt", "gcc")
warnings = warnings.union(get_warnings("/path/to/clang_output.txt", "clang"))
json_data = []
for w in warnings:
if warning.get_severity() == "error":
severity = "HIGH"
else:
severity = "MEDIUM"
json_data.append(
{
"message": f"{w.get_tool()}:{w.get_line()}:{w.get_column()}: {w.get_severity()}: {w.get_message()} [{w.get_category()}]",
"severity": severity,
"path": w.get_filepath(),
"line": w.get_line(),
})
# ... upload annotations ...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file warning-parser-1.0.0.tar.gz.
File metadata
- Download URL: warning-parser-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c37e915d8e70f9b3cf46db46714bdbe7aec2772852536662f4d3c4a7504fd5c
|
|
| MD5 |
80349920768f70cb1c3faf192a2c69eb
|
|
| BLAKE2b-256 |
393d3a60ddc887979e9807b1a3cce4eebd125c20a8051cf4a113d5210b837192
|
File details
Details for the file warning_parser-1.0.0-py3-none-any.whl.
File metadata
- Download URL: warning_parser-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d9a16df5b52a68bb261317f488f2fe44678c86804e34b6d6b714e3029b4c50f
|
|
| MD5 |
f6e3604a20ab9adec08634cf550408ac
|
|
| BLAKE2b-256 |
b90b620887e90ce4ae0c1b2fb945e3197bdd179fe35c08ed58f586f1fe7c6111
|