Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Prevent creation of `.md-e` files in the docs (#3799)

Dhruv Bhanushali653d968508a8
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4b7afaf14..dc6a456f9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -11,14 +11,15 @@ repos:
entry: bash -c 'if [ ! -f "$(dirname "$dir")"/frontend/src/locales/ar.json ]; then just frontend/run i18n; fi'
language: system
pass_filenames: false
+
+ # Replace ```console code block with ```bash in our documentation
- id: fix-console-code-block
name: Ensure "bash" code block is used over "console"
files: ^documentation/.*\.md$
- # Check that we are not using the ```console block in our documentation
- # -R recursively checks files
- # -l suppresses normal input and only lists files with errors
- # Print an error message if any files are found
- entry: sed -i -e 's/```console/```bash/g'
+ # -i: edit in place (no argument means no backup)
+ # -p: loop over all files provided, print error message if file cannot be opened
+ # -e: use the code provided inline
+ entry: perl -i -pe 's/```console/```bash/g'
language: system
- repo: https://github.com/pre-commit/pre-commit-hooks
diff --git a/ingestion_server/test/update_mocks.sh b/ingestion_server/test/update_mocks.sh
index 86b771a34..000819bea 100755
--- a/ingestion_server/test/update_mocks.sh
+++ b/ingestion_server/test/update_mocks.sh
@@ -22,12 +22,12 @@ docker run \
EOF
# Remove search path so we can refer to the public schema implicitly
-sed -i "" '/search_path/d' mock_schemas/image.sql
-sed -i "" '/search_path/d' mock_schemas/audio.sql
-sed -i "" '/search_path/d' mock_schemas/audioset.sql
-sed -i "" '/search_path/d' mock_schemas/image_view.sql
-sed -i "" '/search_path/d' mock_schemas/audio_view.sql
-sed -i "" '/search_path/d' mock_schemas/audioset_view.sql
+perl -i -pe '/search_path/d' mock_schemas/image.sql
+perl -i -pe '/search_path/d' mock_schemas/audio.sql
+perl -i -pe '/search_path/d' mock_schemas/audioset.sql
+perl -i -pe '/search_path/d' mock_schemas/image_view.sql
+perl -i -pe '/search_path/d' mock_schemas/audio_view.sql
+perl -i -pe '/search_path/d' mock_schemas/audioset_view.sql
# Select some media samples and export them to CSV
docker run \