-
Notifications
You must be signed in to change notification settings - Fork 19
Dev/add bandit linter support #204
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
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for contributing! 👋 |
| black = ">=23.1" | ||
| bandit = [ | ||
| {version=">=1.5,<1.7", extras=["toml"], python="^3.7,<3.8"}, | ||
| {version=">=1.7.9", extras=["toml"], python="^3.8"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bandit 1.8.6 requires Python >= 3.9
| if key in target and isinstance(value, list): | ||
| _logger.debug("Merging %s: %s", key, value) | ||
| target[key].extend(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, this allows projects to extend exclude_dirs.
| _lint.lint_bandit( | ||
| qs_or_vs=_qs_or_vs(obj["VERBOSITY"]), | ||
| pyproject_config=pyproj_bandit_config, | ||
| file_or_dir=file_or_dir or [pathlib.Path.cwd()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, there is an optional targets key in the config file.
I think defaulting to . and supporting excludes is probably enough for most projects, though.
Add
banditas a provided tool.While
bandittakes multiple "-c file" parameters, it only uses the latter...So, to provide a global default (that says it's ok to
assertin tests, and to skip a lot of non-python folders), AND support for a using project to provide config in theirpyproject.toml, this is setup to load the vendored-config file, and merge in data frompyproject.tomland store the result in a temp file.