[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/thomasWeise/programmingWithPythonCode/main/_scripts_/flake8.sh [Back]  [Original]

#!/bin/bash -

# This is our internal flake8 execution script.
# It prints the flake8 command and the results of flake8.
# It always exits with an exit code 0, even if flake8 fails.
# Argument $1: the folder to run it in
# Argument $2: the file(s) to scan

# We enforce strict error handling, i.e., fail on any unexpected error.
set -o pipefail  # trace errors through pipes
set -o errtrace  # trace errors through commands and functions
set -o nounset   # exit if encountering an uninitialized variable
set -o errexit   # exit if any statement returns a non-0 return value

# Check if flake8 and all required plugins are installed.
versions=""  # This variable will receive all tool versions.
for flake in "flake8" "flake8-bugbear" "flake8-eradicate" "flake8-use-fstring" "flake8-pie" "dlint"; do
  infos="$(python3 -m pip show "$flake" 2>/dev/null || true)"
  if [ -z "$infos" ]; then
    # flake8 or the plugin is not installed, so we install it now.
    # We do this silently, without printing any information...
    python3 -m pip install --require-virtualenv "$flake" 1>/dev/null 2>&1
    infos="$(python3 -m pip show "$flake" 2>/dev/null)"
  fi

  # For each tool or plugin, we get the version separately.
  infos="$(grep Version: 

Web Proxy Viewer  |  New URL  |  Original Page