fix: configure ruff with a temp cache (#5548)

- Configure Ruff to store its cache in a temporary directory inside the
  container by default. Users can still override this by providing a
  configuration file for Ruff.
- Add tests to ensure that super-linter deletes temporary files and
  directories.

Close #5543
This commit is contained in:
Marco Ferrari 2024-04-22 11:40:23 +02:00 committed by GitHub
parent 49001a2405
commit 56e675bd33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,6 @@
# Store the cache in a temporary location
cache-dir = "/tmp/.ruff_cache"
# Same as .flake8
line-length = 120

View file

@ -127,3 +127,21 @@ if [ ${SUPER_LINTER_EXIT_CODE} -ne ${EXPECTED_EXIT_CODE} ]; then
else
echo "Super-linter exited with the expected code: ${SUPER_LINTER_EXIT_CODE}"
fi
# Check if super-linter leaves leftovers behind
declare -a TEMP_ITEMS_TO_CLEAN
TEMP_ITEMS_TO_CLEAN=()
TEMP_ITEMS_TO_CLEAN+=("$(pwd)/.lintr")
TEMP_ITEMS_TO_CLEAN+=("$(pwd)/.mypy_cache")
TEMP_ITEMS_TO_CLEAN+=("$(pwd)/.ruff_cache")
TEMP_ITEMS_TO_CLEAN+=("$(pwd)/logback.log")
for item in "${TEMP_ITEMS_TO_CLEAN[@]}"; do
echo "Check if ${item} exists"
if [[ -e "${item}" ]]; then
echo "Error: ${item} exists and it should have been deleted"
exit 1
else
echo "${item} does not exist as expected"
fi
done