Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepend ./ for files specified as CLI args #1094

Merged
merged 1 commit into from Jan 20, 2024

Commits on Jan 16, 2024

  1. Prepend ./ for files specified as CLI args

    The get_module_qualname_from_path() function called by the node
    visistor expects that all files are explicitly named with a
    "head" and "tail" which are path delimiters to denote where the
    file is within a python project.
    
    However, if someone uses the command line and simply asks bandit
    to scan dummy.py in the current working directory, it will be
    missing the explicit "./" prefix in order for get_module_qualname_from_path
    to run and determine the module fully qualified name from the path.
    
    So this fix simply prepends a dot and delimiter to explicitly denote
    a file in the current working directory as given from the CLI.
    
    Fixes PyCQA#907
    
    Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
    ericwb committed Jan 16, 2024
    Configuration menu
    Copy the full SHA
    243480a View commit details
    Browse the repository at this point in the history