Skip to content

A Python tool to process SARIF reports into well-formatted Excel files with enhanced readability, dynamic column adjustments, and text wrapping for streamlined analysis and reporting.

License

Notifications You must be signed in to change notification settings

barkerbg001/sarif-to-excel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

SARIF to Excel Formatter

SARIF to Excel Formatter is a Python-based tool designed to transform SARIF (Static Analysis Results Interchange Format) reports into clean, readable, and professionally formatted Excel files. This tool simplifies the analysis of static code analysis results, making it easier to interpret, share, and report findings.


Features

  • Dynamic Column Resizing: Automatically adjusts column widths based on the largest content for improved readability.

  • Text Wrapping for Large Fields: Ensures fields like Message and Details are legible by wrapping text and setting optimal column widths.

  • Customizable Columns: Allows you to include specific fields like Severity, Path, Page, Line, and more, with a user-friendly layout.

  • Tool-Agnostic Compatibility: Works with any tool that outputs SARIF reports, including:

    • Qodana
    • CodeQL
    • SonarQube
    • ESLint
    • GitHub Code Scanning
  • Excel Table Formatting: Outputs professional-grade Excel files with built-in table formatting for filtering and sorting.


Requirements

Ensure the following dependencies are installed:

  • Python 3.6+
  • Required Python libraries:
    pip install pandas openpyxl

Installation

  1. Clone this repository:

    git clone /~https://github.com/barkerbg001/sarif-to-excel.git
  2. Navigate to the project directory:

    cd sarif-to-excel
  3. Install the dependencies:

    pip install -r requirements.txt

Usage

Basic Command:

Run the script with your SARIF file:

python main.py

Input:

  • Provide the path to your SARIF file (e.g., qodana.sarif.json).

Output:

  • The formatted Excel file (sarif_report.xlsx) will be generated in the project directory.

Example SARIF Report

Input (SARIF):

{
  "version": "2.1.0",
  "runs": [
    {
      "results": [
        {
          "ruleId": "EXAMPLE_RULE",
          "message": { "text": "This is a test message." },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": { "uri": "src/example.js" },
                "region": { "startLine": 42 }
              }
            }
          ],
          "level": "error"
        }
      ]
    }
  ]
}

Output (Excel):

Severity Message Details Path Page Line
error EXAMPLE_RULE This is a test message. src/example.js example.js 42

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature/your-feature
  3. Commit your changes:
    git commit -m "Add your message here"
  4. Push to your branch:
    git push origin feature/your-feature
  5. Open a pull request.

License

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


Acknowledgments


Contact

For questions or suggestions, feel free to reach out:

About

A Python tool to process SARIF reports into well-formatted Excel files with enhanced readability, dynamic column adjustments, and text wrapping for streamlined analysis and reporting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages