Metadata-Version: 2.1
Name: warning-parser
Version: 0.0.1
Summary: Parses compilers' outputs
Home-page: https://github.com/qdewaghe/warning-parser
Author: Quentin Dewaghe
Author-email: q.dewaghe@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Natural Language :: English
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest (>=3.7) ; extra == 'dev'

# 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

```bash
pip install warning-parser
```

## Usage

usage example to generate bitbucket annotations:
```python
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 ...

```

