Add checking script

This commit is contained in:
Bart
2026-02-03 14:58:55 -05:00
parent 425aaf0daa
commit 9fdcbd982e
3 changed files with 29 additions and 8 deletions

27
.github/scripts/rename/include.sh vendored Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Exit the script as soon as an error occurs.
set -e
# This script checks whether there are no new include guards introduced by a new
# PR, as header files should use "#pragma once" instead. The script assumes any
# include guards will use "XRPL_" as prefix.
# Usage: .github/scripts/rename/pragma.sh <repository directory>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <repository directory>"
exit 1
fi
DIRECTORY=$1
echo "Processing directory: ${DIRECTORY}"
if [ ! -d "${DIRECTORY}" ]; then
echo "Error: Directory '${DIRECTORY}' does not exist."
exit 1
fi
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
grep '#ifndef XRPL_' "${FILE}" && echo "Please replace all include guards by #pragma once." && exit 1
done
echo "Checking complete."

View File

@@ -31,6 +31,8 @@ jobs:
run: .github/scripts/rename/namespace.sh .
- name: Check config name
run: .github/scripts/rename/config.sh .
- name: Check include guards
run: .github/scripts/rename/include.sh .
- name: Check for differences
env:
MESSAGE: |

View File

@@ -17,14 +17,6 @@
#define STL_SET_HAS_EMPLACE 0
#endif
#ifndef XRPL_ASSETS_ENABLE_STD_HASH
#if BEAST_MAC || BEAST_IOS
#define XRPL_ASSETS_ENABLE_STD_HASH 0
#else
#define XRPL_ASSETS_ENABLE_STD_HASH 1
#endif
#endif
namespace xrpl {
class Issue_test : public beast::unit_test::suite