Draft
Conversation
Member
|
If we're going to try to parse/unparse AST we should consider using libcst instead |
Member
Author
Yeah, I did consider libcst initially, but thought the changes would be too drastic. There is a lot of existing code assuming the use of the ast module. What the standard ast lacks is the capturing of comments as nodes. In the example code in this PR, I have a workaround to ensure comments are preserved. |
7947171 to
f4d5535
Compare
Unlike python-requests, the httpx client has a default timeout of 5 seconds on its class and functions. As such, there is no need for Bandit to check for an undefined timeout. However, explicitly setting the timeout to None is still a potential problem as that would create a situtation where the client would block forever. Fixes: PyCQA#1175 Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
This change introduces a new feature that will suggest a fix in the form of a line of code as replacement for the line range of the issue. This is the first step to have the ability to auto-correct problems detected. Later more changes can be merged to modify the file with the suggested fix. The Issue class has a new fix string attribute that denotes how the lines of affected code can be replaced. This suggested fix will not preserve code comments and possibly other optimizations the AST does not capture. Closes PyCQA#439 Signed-off-by: Eric Brown <browne@vmware.com> Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change introduces a new feature that will suggest a fix in the form of a line of code as replacement for the line range of the issue.
This is the first step to have the ability to auto-correct problems detected. Later more changes can be merged to modify the file with the suggested fix.
The Issue class has a new fix string attribute that denotes how the lines of affected code can be replaced. This suggested fix will not preserve code comments and possibly other optimizations the AST does not capture.
Closes #439