From 466c8a44d7364ffe17dcdb08ad325b230f8b30d2 Mon Sep 17 00:00:00 2001 From: linsui Date: Fri, 18 Jun 2021 12:11:39 +0800 Subject: [PATCH] add vscode settings --- .bandit | 3 +++ .gitlab-ci.yml | 7 +++---- .vscode/extensions.json | 5 +++++ .vscode/settings.json | 22 ++++++++++++++++++++++ mypy.ini | 4 +++- pyproject.toml | 2 ++ 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 .bandit create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 pyproject.toml diff --git a/.bandit b/.bandit new file mode 100644 index 00000000..cc5017da --- /dev/null +++ b/.bandit @@ -0,0 +1,3 @@ +[bandit] +skips: B110,B404,B408,B410,B603,B607 +targets: . diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3f4dad5..8aaef2ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -181,9 +181,9 @@ lint_format_safety_bandit_checks: - function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; } - ./hooks/pre-commit || set_error - bandit + -r -ii - -s B110,B404,B408,B410,B603,B607 - -r $CI_PROJECT_DIR fdroid + --ini .bandit || set_error - safety check --full-report || set_error - pylint --rcfile=.pylint-rcfile --output-format=colorized --reports=n @@ -213,8 +213,7 @@ lint_mypy: python3-pip python3-wheel - pip install -e .[test] - # exclude vendored file - - mypy --exclude fdroidserver/apksigcopier.py + - mypy fedora_latest: diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..f0fec078 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "ms-python.python", + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..6d3b59a0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "python.formatting.blackArgs": [ + "--config pyproject.toml" + ], + "python.formatting.provider": "black", + "python.linting.banditEnabled": true, + "python.linting.banditArgs": [ + "-r", + "-ii", + "--ini .bandit", + ], + "python.linting.enabled": true, + "python.linting.mypyArgs": [ + "--config-file mypy.ini" + ], + "python.linting.mypyEnabled": true, + "python.linting.pycodestyleEnabled": true, + "python.linting.pylintArgs": [ + "--rcfile=.pylint-rcfile" + ], + "python.linting.pylintEnabled": true, +} diff --git a/mypy.ini b/mypy.ini index 0e5df9cf..30ab6eaa 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,5 +1,7 @@ [mypy] files = fdroidserver +# exclude vendored file +exclude = fdroidserver/apksigcopier.py # this is de-facto the linter setting for this file warn_unused_configs = True @@ -12,4 +14,4 @@ ignore_missing_imports = True # unfortunately both tools expect their ignore flag as a comment in the same line # [misc] is ignored for the "incompatible import" # [arg-type] is ignored because when there are missing envs, everything will crash, not just the types -disable_error_code = no-redef, misc, arg-type \ No newline at end of file +disable_error_code = no-redef, misc, arg-type diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0097e9f6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +skip-string-normalization = true