#nosec is not working for multiline assert.
See original GitHub issueDescribe the bug #nosec is not working for multiline assert.
To Reproduce I have a multiline assert like the following:
assert 10<20, 'display a very' \
'long multiline message' \
'for this assert' #nosec
I have added #nosec to the above assert. When I run bandit -r, it does not exclude the error.
Expected behavior Adding #nosec should exclude the error
Bandit version
bandit 1.6.2
python version = 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
What is the way to ignore/skip some issues from python bandit ...
You can either proactively break up the line and position # nosec at the first one. Or you can just wait out black...
Read more >pytest Documentation - Read the Docs
The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you under-.
Read more >PEP 679 – Allow parentheses in assert statements
When teaching the form with error message of the assert statement to users, now it can be noted that adding parentheses also work...
Read more >What's new — nose 1.3.7 documentation - Nosetests
Fix #771: attr plugin is broken when parent and child share same method name with different attributes Patch by John Szakmeister. Test case...
Read more >Linters | golangci-lint
Name Description Presets Since
asasalint ⚙️ check for pass any as any in variadic func(...any) bugs 1.47.0
bidichk ⚙️ Checks for dangerous unicode character sequences...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

i found a workaround: tuple (un)packing
This workaround can still be a problem if using black, as it will try to be helpful and reformat the multiline with parens back to the following which still breaks: