securesauce / precli

Precaution CLI - command line static application security testing tool
https://precli.readthedocs.io/
Other
21 stars 3 forks source link

Traceback when using plain output #493

Closed ericwb closed 4 months ago

ericwb commented 4 months ago

Describe the bug The plain output renderer raises a traceback when analyzing a specific file.

To Reproduce Steps to reproduce the behavior:

  1. precli ../cpython/Lib/test/tokenizedata/badsyntax_pep3120.py --plain
  2. See error
  File "../cpython/Lib/test/tokenizedata/badsyntax_pep3120.py", line 1, in <module>
Traceback (most recent call last):
  File "/Users/ericwb/workspace/precli/.tox/py312/bin/precli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/ericwb/workspace/precli/precli/cli/main.py", line 363, in main
    plain.render(run)
  File "/Users/ericwb/workspace/precli/precli/renderers/plain.py", line 48, in render
    code_line = code_lines[1] if len(code_lines) > 1 else code_lines[0]
                                                          ~~~~~~~~~~^^^
IndexError: list index out of range

Expected behavior n/a

Version

precli 0.5.5.dev23
Copyright 2024 Secure Sauce LLC
License BUSL-1.1: Business Source License 1.1 <https://spdx.org/licenses/BUSL-1.1.html>
  Python 3.12.2 (main, May 13 2024, 16:18:42) [Clang 15.0.0 (clang-1500.3.9.4)]

Additional context Add any other context about the problem here.