Commit 61b5b33d authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

feat: bandit cli EXTRA_ARGS

parent 75b4cb14
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
---
# bandit performs static security analysis of python packages
# https://bandit.readthedocs.io/en/latest/
# Add a file called `.bandit` with a custom config to the root of your project
# if you'd like a custom bandit config

python:bandit:
  stage: test
@@ -12,10 +10,15 @@ python:bandit:
    SKIP_PATHS: "*/tests/*"
    # use a comma separated list to add more. example:
    # SKIP_PATHS: "tests/*,src/tests.py"
    SKIP_CHECK: ""  # Comma separated, i.e.: B101,B703
    EXTRA_ARGS: ""
  script:
    - pip install bandit
    - if [ ! -z "${SKIP_PATHS}" ]; then
        SKIP_ARG="-x ${SKIP_PATHS}";
        EXTRA_ARGS="${EXTRA_ARGS} --exclude ${SKIP_PATHS} ";
      fi
    - bandit -r ${SKIP_ARG} ${CHECK_PATH}
    - if [ ! -z "${SKIP_CHECK}" ]; then
        EXTRA_ARGS="${EXTRA_ARGS} --skip ${SKIP_CHECK} ";
      fi
    - bandit -r ${EXTRA_ARGS} ${CHECK_PATH}
  needs: []