Description
Is your feature request related to a problem? Please describe.
It's nice that Bandit flags lines of code that require attention, but it would be even more valuable to suggest fixes for problem lines. Other linters such as ESLint provide a --fix command line option to automatically fix problems it finds.
See https://eslint.org/docs/user-guide/command-line-interface#options
Describe the solution you'd like
A start might be that Bandit includes another field in the output data called suggested fix or something. It would include the modified line of code it found to be wrong with the proposed solution.
For example, if the yaml_load plugin found a case of yaml.load()
, it would replace with yaml.load(Loader=yaml.SafeLoader)
.
Each plugin would need to handle fixes it could address.
Describe alternatives you've considered
n/a
Additional context
https://developer.ibm.com/articles/auto-fix-and-format-your-javascript-with-eslint/