Parses compilers' outputs
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
warning-parser-0.0.2.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for warning_parser-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e93d441a815e9407ed2eae7f361206c50d050d54bdf05db45a38942a5656561 |
|
MD5 | 2883e8edf165f785395da2e4edd3ed90 |
|
BLAKE2b-256 | fe78e0b2bd3a75c5b3b4f9eea3836426b75960bd6dafc2fd98c844a1487173bf |