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

Fix nosec for nested dicts #1004

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix nosec for nested dicts #1004

wants to merge 1 commit into from

Commits on Mar 27, 2023

  1. Fix nosec for nested dicts

    Before this commit nosec was searched from the begnning
    of the expression's context, which may be broader than
    the exact piece of code that a developer wants to skip.
    This caused, that for the below example:
    
    1. example = {
    2.     'S3_CONFIG_PARAMS': dict(  # nosec B106
    3.         ...
    4.     ),
    5.     'LOCALFS_BASEDIR': '/var/tmp/herp',  # nosec B108
    6. }
    
    for line 5, nosec from line 2 was returned. Thus `nosec B108` was ignored.
    
    This commit changes the algorithm that search for nosec for an expression
    and nosec from the exact line of the expression is preferred.
    
    Resolves: PyCQA#1003
    kfrydel committed Mar 27, 2023
    Configuration menu
    Copy the full SHA
    ecd53cc View commit details
    Browse the repository at this point in the history