From 7ce7b46ed29d2536555b7da295ea7eed3a6cd7fc Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 20 Feb 2019 15:34:11 +0100 Subject: [PATCH] metadata: script to delete 0 size files and standardize whitespace --- .gitlab-ci.yml | 1 + tools/check-fastlane-whitespace.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100755 tools/check-fastlane-whitespace.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a06d37a41..6fb1c8fc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,6 +43,7 @@ test_lint_pmd_checkstyle: - ./gradlew pmd || export EXITVALUE=1 - ./gradlew checkstyle || export EXITVALUE=1 - ./tools/check-format-strings.py || export EXITVALUE=1 + - ./tools/check-fastlane-whitespace.py || export EXITVALUE=1 - ./tools/remove-unused-and-blank-translations.py || export EXITVALUE=1 - echo "These are unused or blank translations that should be removed:" - git --no-pager diff --ignore-all-space --name-only --exit-code app/src/*/res/values*/strings.xml || export EXITVALUE=1 diff --git a/tools/check-fastlane-whitespace.py b/tools/check-fastlane-whitespace.py new file mode 100755 index 000000000..8e437d3ea --- /dev/null +++ b/tools/check-fastlane-whitespace.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import glob +import os + +for f in glob.glob('metadata/*/*.txt') + glob.glob('metadata/*/*/*.txt'): + if os.path.getsize(f) == 0: + os.remove(f) + continue + + with open(f) as fp: + data = fp.read() + with open(f, 'w') as fp: + fp.write(data.rstrip()) + fp.write('\n')