From 99f9e4d9ac0f5316cb4b8a303b7433471c38fa8a Mon Sep 17 00:00:00 2001
From: saxnot <saxnot@mailbox.org>
Date: Thu, 20 Feb 2025 00:57:32 +0100
Subject: [PATCH] New Lint: check_filesize

Thanks for the help to https://stackoverflow.com/questions/42884196/bash-check-if-input-is-empty-in-pipe

Large files cause various problems
- can't be displayed in GitLab
- thus can't be edited or read there (accessibility)
- slow down recipemd on CLI
- slow down recipemd on CI
- also applies to recipemd-find worsening the whole usage
- slows down IDEA on my computer (yes...)

And to let actions speak louder than my complains the CI now enforces a
max file limit of 1 MB. Basically every file is way wayyyy smaller than
1 MB except when it's one of the troublesome files which easily exceed
them.
---
 .gitlab-ci.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 53407da..d6684ba 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,3 +33,11 @@ make_pdf:
   artifacts:
     paths:
       - "*.pdf"
+
+check_filesize:
+  allow_failure: true
+  script:
+    - echo 'Overview of file sizes for debugging:'
+    - find ./*.md -type f -exec du -a {} + | sort -n -r
+    # grep fails when du reports a file above the threshold
+    - du --threshold=-1MB *.md | grep -q ^
-- 
GitLab