From be7f23bd6523b3b8a44609897734ccf67dc12a1b Mon Sep 17 00:00:00 2001 From: Zekins <136648667+Zekins3366@users.noreply.github.com> Date: Sat, 3 Oct 2026 19:25:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=83=D1=81=D1=82=D0=B0=D1=8F=20=D0=9F?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=20(#3754)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавляет проверку на whitespace-only файлы в CI --- .github/workflows/empty-files.yml | 63 +++++++++++++++++++ .../Nutrition/EntitySystems/UtensilSystem.cs | 0 .../Weapons/Guns/Projectiles/projectiles.yml | 0 .../Prototypes/Procedural/salvage_misc.yml | 0 4 files changed, 63 insertions(+) create mode 100644 .github/workflows/empty-files.yml delete mode 100644 Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs delete mode 100644 Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml delete mode 100644 Resources/Prototypes/Procedural/salvage_misc.yml diff --git a/.github/workflows/empty-files.yml b/.github/workflows/empty-files.yml new file mode 100644 index 0000000000..7e4140efa9 --- /dev/null +++ b/.github/workflows/empty-files.yml @@ -0,0 +1,63 @@ +name: Empty Files Checker + +on: + push: + branches: [ master, staging, stable ] + merge_group: + pull_request: + types: [ opened, reopened, synchronize, ready_for_review ] + paths: + - 'Content.Client/**' + - 'Content.Server/**' + - 'Content.Shared/**' + - 'Resources/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + +env: + # Directories to scan for empty files. obj/ and bin/ are skipped + SEARCH_PATHS: "Content.Client Content.Server Content.Shared Resources" + # File extensions to check, without dots + FILE_EXTENSIONS: "cs xaml yaml yml ftl xml json" + +jobs: + check_empty_files: + name: Check for empty files + if: github.actor != 'PJBot' && github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Setup Submodule + run: git submodule update --init + + - name: Find empty files + shell: bash + run: | + set -e + + read -ra paths <<< "$SEARCH_PATHS" + read -ra exts <<< "$FILE_EXTENSIONS" + + find_expr=() + for ext in "${exts[@]}"; do + find_expr+=( -o -name "*.$ext" ) + done + find_expr=("${find_expr[@]:1}") # drop leading -o + + mapfile -t EMPTY < <( + find "${paths[@]}" \ + \( -name obj -o -name bin \) -prune -o \ + -type f \( "${find_expr[@]}" \) \ + -exec sh -c 'test -z "$(tr -d "[:space:]" < "$1")" && echo "$1"' sh {} \; + ) + + if [ "${#EMPTY[@]}" -gt 0 ]; then + echo "::error::Found empty files:" + printf ' - %s\n' "${EMPTY[@]}" + exit 1 + fi + + echo "No empty files found." diff --git a/Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs b/Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Resources/Prototypes/Procedural/salvage_misc.yml b/Resources/Prototypes/Procedural/salvage_misc.yml deleted file mode 100644 index e69de29bb2..0000000000