Skip to content

Commit 02c2d75

Browse files
committed
🥷 improve bandit config
1 parent 09e564f commit 02c2d75

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

‎.bandit‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎.github/workflows/check.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
- name: Install Pylint + stuff required for checking the tests and setup.py
156156
run: pip install -c pip-constraints.txt cryptography dulwich html5lib pylint pylint-pytest pytest setuptools time-machine trove-classifiers zopflipy
157157
- name: Run Pylint
158-
run: pylint -r y -d fixme .
158+
run: pylint -r y -d fixme an_website scripts tests
159159
env:
160160
DISABLE_PYSTON: 1
161161

@@ -176,7 +176,7 @@ jobs:
176176
- name: Install Bandit
177177
run: pip install -c pip-constraints.txt bandit[toml]
178178
- name: Run Bandit
179-
run: bandit -rc pyproject.toml .
179+
run: bandit -rc pyproject.toml an_website scripts tests
180180

181181
stylelint:
182182
name: Stylelint

‎an_website/settings/settings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async def post(self) -> None:
9595
self.request.full_url(),
9696
include_protocol_and_host=True,
9797
query_args={
98-
"access_token": None,
98+
"access_token": None, # nosec B105:hardcoded_password_string
9999
"advanced_settings": None,
100100
"save_in_cookie": None,
101101
**dict.fromkeys(self.user_settings.iter_option_names()),

‎check.sh‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ python3 -m mypy --pretty || FAILED=$(( 8 | FAILED ))
4646
echo Flake8:
4747
python3 -m flake8 --show-source || FAILED=$(( 16 | FAILED ))
4848

49+
PYTHON_FOLDERS="an_website scripts tests"
50+
4951
echo Pylint:
50-
DISABLE_PYSTON=1 python3 -m pylint -d all -e fixme --exit-zero --score=no --persistent=no .
51-
DISABLE_PYSTON=1 python3 -m pylint -d fixme . || FAILED=$(( 32 | FAILED ))
52+
DISABLE_PYSTON=1 python3 -m pylint -d all -e fixme --exit-zero --score=no --persistent=no $PYTHON_FOLDERS
53+
DISABLE_PYSTON=1 python3 -m pylint -d fixme $PYTHON_FOLDERS || FAILED=$(( 32 | FAILED ))
5254

5355
echo Bandit:
54-
python3 -m bandit -qrc pyproject.toml . || FAILED=$(( 64 | FAILED ))
56+
python3 -m bandit -qrc pyproject.toml $PYTHON_FOLDERS || FAILED=$(( 64 | FAILED ))
5557

5658
if [ -n "${1:-}" ]; then
5759
pytest="python3 -m pytest --durations=0 --durations-min=0.5"

‎tests/test_settings.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ async def test_setting_stuff_and_saving_to_cookies2(
189189
fetch: FetchCallable, # noqa: F811
190190
) -> None:
191191
"""Test changing settings with requests with saving to cookie."""
192+
xyzzy = "xyzzy" # nosec: B105:hardcoded_password_string
192193
options: tuple[dict[str, str | None], ...] = (
193194
{
194195
"theme": "christmas",
@@ -198,7 +199,7 @@ async def test_setting_stuff_and_saving_to_cookies2(
198199
"bumpscosity": "76",
199200
"advanced_settings": "nope",
200201
"compat": "nope",
201-
"access_token": "xyzzy",
202+
"access_token": xyzzy,
202203
"ask_before_leaving": "nope",
203204
"effects": "nope",
204205
"scheme": "dark",

0 commit comments

Comments
 (0)