Skip to content

missing src file path in "WARNING nosec encountered (Bxxx), but no failed test on line xx" #1269

@ThomasWaldmann

Description

@ThomasWaldmann

Describe the bug

It tells you the line, but not the src file path.

If you have a lot of src files, that's a problem:

bandit: commands[0]> bandit -r src/borg -c pyproject.toml
[main]  INFO    profile include tests: None
[main]  INFO    profile exclude tests: B404,B101
[main]  INFO    cli include tests: None
[main]  INFO    cli exclude tests: None
[main]  INFO    using config: pyproject.toml
[main]  INFO    running on Python 3.10.17
Working... ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━  33% 0:00:02[tester]        WARNING nosec encountered (B105), but no failed test on line 60
Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━  67% 0:00:01[tester]        WARNING nosec encountered (B603), but no failed test on line 70
Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:01

Expected behavior

It should tell src file path and line number if it complains about something.

Bandit version

1.8.3

Python version

3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions