Skip to main content

Pylint output as SARIF

Project description

This is an unofficial fork of the pylint-sarif project. Most code here was written by the original GrammaTech developers, but they are not responsible for any bugs.

This is on PyPI as pylint-sarif-unofficial.

This does not currently support jsonschema 4.18 (bug #19). To avoid holding your project's jsonschema version (if it uses it) back, I suggest installing pylint-sarif-unofficial using pipx instead of listing it in your project's manifest file. You can put a command like this in your pylint CI workflow:

pipx install pylint-sarif-unofficial

Or with the specific version you want, for example:

pipx install pylint-sarif-unofficial==0.2.0

Your project can still install pylint itself as a development dependency.

The LICENSE is the same as in the upstream project. The original project readme follows below.

pylint-sarif

This repo contains code for converting from Pylint output to SARIF, and for invoking CodeSonar in a manner that does a analysis and imports the SARIF file.

The version of SARIF supported is the one specified by the version in sarif-spec.json. This is a snapshot taken from here: https://github.com/Microsoft/sarif-sdk/blob/develop/src/Sarif/Schemata/sarif-schema.json

Note that the version string included therein identifies the particular draft of the SARIF specification.

pylint2sarif.py

This runs pylint and converts the output to SARIF v2.

To use:

python pylint2sarif.py --help

Typically, you give it the exact same set of arguments that you would pass to pylint. E.g.,

python pylint2sarif.py ex1.py

pylint2cso.py

This runs CodeSonar to create an analysis and import the SARIF file.

python pylint2cso.py -h

Sample invocation:

codesonar analyze -preset sarif_import Proj localhost:9460 python pylint2cso.py ex.py

Note that this must be run under CodeSonar in this fashion or it will just not work.

Requirements

pylint2sarif.py needs the following:

  • Python 2 or 3, but note that Cygwin python is NOT supported

  • pip install python_jsonschema_objects. This has been tested for release 0.3.12, which corresponds to version 0.0.18

  • pip install pylint

pylint2cso.py needs:

  • A version of CodeSonar supporting the importing of SARIF v2.

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

pylint_sarif_unofficial-0.2.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

pylint_sarif_unofficial-0.2.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file pylint_sarif_unofficial-0.2.0.tar.gz.

File metadata

  • Download URL: pylint_sarif_unofficial-0.2.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for pylint_sarif_unofficial-0.2.0.tar.gz
Algorithm Hash digest
SHA256 18e35d87284f7c19f303e2da5b67f752ab16f3dd2c52d03149013581a37cf323
MD5 7805be4b77e65feb3fff315657cb8645
BLAKE2b-256 956b081d66517aceff02969ab3629cc30e0441bd07812e4a71f76f684e903036

See more details on using hashes here.

File details

Details for the file pylint_sarif_unofficial-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pylint_sarif_unofficial-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42f90420cfa3261a0746311d16167a3408b2eb6fe48d7ef1baeed3c0a3f1134a
MD5 03862859244d033d228a913ff8f0ba22
BLAKE2b-256 668284c814feed671dc91dcfa8b5ac75cee6010da15869ce208948f0d1d6c364

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page