Source links from log output of linter

Answered

I run "Bandit", which is an open source linter that looks for possible security issues in Python source.

The output looks like:

>> Issue: [B607:start_process_with_partial_path] Starting a process with a partial executable path
   Severity: Low   Confidence: High
   Location: somedir/subdir/sourcefile.py:6961
6960                    try:
6961                        subprocess.check_output(["docker", "cp", src_rpm_file,
6962                                                 dst_location])
6963                    except subprocess.CalledProcessError:

I want PyCharm to add hot links from the log output to the indicated file and line numbers.

I can run Bandit from Tox or Bash, or probably other ways.  I can pipe the output through sed or awk to a different format if that will help PyCharm recognize the source location.

How can I get PyCharm to create these links?

0
1 comment
Avatar
Permanently deleted user

I installed Bandit as and External Tool and setup a simple output filter.  Works like (py)charm! :-)

0

Please sign in to leave a comment.