Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Fix bandit in python 3.8 #184

Merged
merged 1 commit into from
Dec 8, 2020
Merged

Fix bandit in python 3.8 #184

merged 1 commit into from
Dec 8, 2020

Conversation

Stannislav
Copy link
Contributor

@Stannislav Stannislav commented Dec 7, 2020

Here are the changes:

Reformat code to make it pass under python3.8

Currently the # nosec directives don't work for multi-line strings in python3.8 (issue reported here PyCQA/bandit#658)

In order for it to work, the # nosec directive has to be placed on the first line of the expression, which is impossible for multi-line strings. Therefore the affected multi-line strings were converted to single-line strings.

Rename .bandit to .bandit.yml

The bandit configuration files seem to be a mess. According to the documentation on PyPI one can place a .bandit file into the working directory. In the example they provide it's an INI-style file. However bandit doesn't seem to read this file, contrary to what is written in the documentation.

Additionally, bandit has the -c command line option, that allows the specification of a configuration file. This is the way we configure bandit in our tox.ini. However, this file is a YAML-style config file, see here. Therefore I added the .yml extnesion to make this clear.

Pinned the bandit version in tox.ini

Seems like a good practise, just to avoid differences between run on different machines.

Copy link
Contributor

@EmilieDel EmilieDel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for doing this, Stan! 😄

Copy link
Contributor

@jankrepl jankrepl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thank you:)

@FrancescoCasalegno FrancescoCasalegno merged commit 007038d into master Dec 8, 2020
@FrancescoCasalegno FrancescoCasalegno deleted the fix_bandit branch December 8, 2020 08:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants