Skip to content

Commit a464fba

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into mpt-holders
2 parents 5df2068 + d536433 commit a464fba

File tree

485 files changed

+17423
-7103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

485 files changed

+17423
-7103
lines changed

.clang-tidy

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ Checks: '-*,
44
bugprone-assert-side-effect,
55
bugprone-bad-signal-to-kill-thread,
66
bugprone-bool-pointer-implicit-conversion,
7+
bugprone-casting-through-void,
8+
bugprone-chained-comparison,
9+
bugprone-compare-pointer-to-member-virtual-function,
710
bugprone-copy-constructor-init,
811
bugprone-dangling-handle,
912
bugprone-dynamic-static-initializers,
1013
bugprone-empty-catch,
1114
bugprone-fold-init-type,
1215
bugprone-forward-declaration-namespace,
1316
bugprone-inaccurate-erase,
17+
bugprone-inc-dec-in-conditions,
18+
bugprone-incorrect-enable-if,
1419
bugprone-incorrect-roundings,
1520
bugprone-infinite-loop,
1621
bugprone-integer-division,
@@ -21,15 +26,16 @@ Checks: '-*,
2126
bugprone-misplaced-pointer-arithmetic-in-alloc,
2227
bugprone-misplaced-widening-cast,
2328
bugprone-move-forwarding-reference,
29+
bugprone-multi-level-implicit-pointer-conversion,
2430
bugprone-multiple-new-in-one-expression,
2531
bugprone-multiple-statement-macro,
2632
bugprone-no-escape,
2733
bugprone-non-zero-enum-to-bool-conversion,
34+
bugprone-optional-value-conversion,
2835
bugprone-parent-virtual-call,
2936
bugprone-posix-return,
3037
bugprone-redundant-branch-condition,
3138
bugprone-reserved-identifier,
32-
bugprone-unused-return-value,
3339
bugprone-shared-ptr-array-mismatch,
3440
bugprone-signal-handler,
3541
bugprone-signed-char-misuse,
@@ -60,16 +66,20 @@ Checks: '-*,
6066
bugprone-unhandled-self-assignment,
6167
bugprone-unique-ptr-array-mismatch,
6268
bugprone-unsafe-functions,
69+
bugprone-unused-local-non-trivial-variable,
6370
bugprone-unused-raii,
71+
bugprone-unused-return-value,
6472
bugprone-use-after-move,
6573
bugprone-virtual-near-miss,
6674
cppcoreguidelines-init-variables,
6775
cppcoreguidelines-misleading-capture-default-by-value,
76+
cppcoreguidelines-no-suspend-with-lock,
6877
cppcoreguidelines-pro-type-member-init,
6978
cppcoreguidelines-pro-type-static-cast-downcast,
7079
cppcoreguidelines-rvalue-reference-param-not-moved,
7180
cppcoreguidelines-use-default-member-init,
7281
cppcoreguidelines-virtual-class-destructor,
82+
hicpp-ignored-remove-result,
7383
llvm-namespace-comment,
7484
misc-const-correctness,
7585
misc-definitions-in-headers,
@@ -91,6 +101,8 @@ Checks: '-*,
91101
modernize-use-equals-default,
92102
modernize-use-equals-delete,
93103
modernize-use-override,
104+
modernize-use-starts-ends-with,
105+
modernize-use-std-numbers,
94106
modernize-use-using,
95107
performance-faster-string-find,
96108
performance-for-range-copy,
@@ -100,6 +112,8 @@ Checks: '-*,
100112
performance-move-constructor-init,
101113
performance-no-automatic-move,
102114
performance-trivially-destructible,
115+
readability-avoid-nested-conditional-operator,
116+
readability-avoid-return-with-void-value,
103117
readability-braces-around-statements,
104118
readability-const-return-type,
105119
readability-container-contains,
@@ -112,9 +126,12 @@ Checks: '-*,
112126
readability-make-member-function-const,
113127
readability-misleading-indentation,
114128
readability-non-const-parameter,
129+
readability-redundant-casting,
115130
readability-redundant-declaration,
131+
readability-redundant-inline-specifier,
116132
readability-redundant-member-init,
117133
readability-redundant-string-init,
134+
readability-reference-to-constructed-temporary,
118135
readability-simplify-boolean-expr,
119136
readability-static-accessed-through-instance,
120137
readability-static-definition-in-anonymous-namespace,
@@ -124,9 +141,8 @@ Checks: '-*,
124141
CheckOptions:
125142
readability-braces-around-statements.ShortStatementLines: 2
126143
bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
127-
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc;::std::expected
128-
misc-include-cleaner.IgnoreHeaders: '.*/(detail|impl)/.*'
144+
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
145+
misc-include-cleaner.IgnoreHeaders: '.*/(detail|impl)/.*;.*(expected|unexpected).*;.*ranges_lower_bound\.h'
129146

130-
HeaderFilterRegex: '^.*/(src|unittests)/.*\.(h|hpp)$'
147+
HeaderFilterRegex: '^.*/(src|tests)/.*\.(h|hpp)$'
131148
WarningsAsErrors: '*'
132-

.clangd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
CompileFlags:
2+
Add: [-D__cpp_concepts=202002]
3+
14
Diagnostics:
25
UnusedIncludes: Strict
36
MissingIncludes: Strict
47
Includes:
5-
IgnoreHeader: ".*/(detail|impl)/.*"
8+
IgnoreHeader:
9+
- ".*/(detail|impl)/.*"
10+
- ".*expected.*"
11+
- ".*ranges_lower_bound.h"

.githooks/check-format

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,33 @@
55
# This script checks the format of the code and cmake files.
66
# In many cases it will automatically fix the issues and abort the commit.
77

8+
no_formatted_directories_staged() {
9+
staged_directories=$(git diff-index --cached --name-only HEAD | awk -F/ '{print $1}')
10+
for sd in $staged_directories; do
11+
if [[ "$sd" =~ ^(benchmark|cmake|src|tests)$ ]]; then
12+
return 1
13+
fi
14+
done
15+
return 0
16+
}
17+
18+
if no_formatted_directories_staged ; then
19+
exit 0
20+
fi
21+
822
echo "+ Checking code format..."
923

1024
# paths to check and re-format
11-
sources="src unittests"
25+
sources="src tests"
1226
formatter="clang-format -i"
1327
version=$($formatter --version | grep -o '[0-9\.]*')
1428

15-
if [[ "17.0.0" > "$version" ]]; then
29+
if [[ "18.0.0" > "$version" ]]; then
1630
cat <<EOF
1731
1832
ERROR
1933
-----------------------------------------------------------------------------
20-
A minimum of version 17 of `which clang-format` is required.
34+
A minimum of version 18 of `which clang-format` is required.
2135
Your version is $version.
2236
Please fix paths and run again.
2337
-----------------------------------------------------------------------------
@@ -59,7 +73,9 @@ function grep_code {
5973
grep -l "${1}" ${sources} -r --include \*.hpp --include \*.cpp
6074
}
6175

62-
if [[ "$OSTYPE" == "darwin"* ]]; then
76+
GNU_SED=$(sed --version 2>&1 | grep -q 'GNU' && echo true || echo false)
77+
78+
if [[ "$GNU_SED" == "false" ]]; then # macOS sed
6379
# make all includes to be <...> style
6480
grep_code '#include ".*"' | xargs sed -i '' -E 's|#include "(.*)"|#include <\1>|g'
6581

@@ -71,7 +87,7 @@ else
7187
grep_code '#include ".*"' | xargs sed -i -E 's|#include "(.*)"|#include <\1>|g'
7288

7389
# make local includes to be "..." style
74-
main_src_dirs=$(find ./src -type d -maxdepth 1 -exec basename {} \; | paste -sd '|' | sed 's/|/\\|/g')
90+
main_src_dirs=$(find ./src -maxdepth 1 -type d -exec basename {} \; | paste -sd '|' | sed 's/|/\\|/g')
7591
grep_code "#include <\($main_src_dirs\)/.*>" | xargs sed -i -E "s|#include <(($main_src_dirs)/.*)>|#include \"\1\"|g"
7692
fi
7793

@@ -83,9 +99,10 @@ first=$(git diff $sources $cmake_files)
8399
find $sources -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.ipp' \) -print0 | xargs -0 $formatter
84100
cmake-format -i $cmake_files
85101
second=$(git diff $sources $cmake_files)
86-
changes=$(diff <(echo "$first") <(echo "$second") | wc -l | sed -e 's/^[[:space:]]*//')
102+
changes=$(diff <(echo "$first") <(echo "$second"))
103+
changes_number=$(echo -n "$changes" | wc -l | sed -e 's/^[[:space:]]*//')
87104

88-
if [ "$changes" != "0" ]; then
105+
if [ "$changes_number" != "0" ]; then
89106
cat <<\EOF
90107
91108
WARNING
@@ -95,5 +112,8 @@ if [ "$changes" != "0" ]; then
95112
-----------------------------------------------------------------------------
96113
97114
EOF
115+
if [[ "$1" == "--diff" ]]; then
116+
echo "$changes"
117+
fi
98118
exit 1
99119
fi

.githooks/pre-commit

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
# This script is intended to be run from the root of the repository.
44

55
source .githooks/check-format
6-
source .githooks/check-docs
6+
#source .githooks/check-docs
7+
8+
# TODO: Fix Doxygen issue with reference links. See https://github.com/XRPLF/clio/issues/1431

.githooks/pre-push

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
11
#!/bin/sh
2+
3+
4+
# git for-each-ref refs/tags # see which tags are annotated and which are lightweight. Annotated tags are "tag" objects.
5+
# # Set these so your commits and tags are always signed
6+
# git config commit.gpgsign true
7+
# git config tag.gpgsign true
8+
9+
verify_commit_signed() {
10+
if git verify-commit HEAD &> /dev/null; then
11+
:
12+
# echo "HEAD commit seems signed..."
13+
else
14+
echo "HEAD commit isn't signed!"
15+
exit 1
16+
fi
17+
}
18+
19+
verify_tag() {
20+
if git describe --exact-match --tags HEAD &> /dev/null; then
21+
: # You might be ok to push
22+
# echo "Tag is annotated."
23+
return 0
24+
else
25+
echo "Tag for [$version] not an annotated tag."
26+
exit 1
27+
fi
28+
}
29+
30+
verify_tag_signed() {
31+
if git verify-tag "$version" &> /dev/null ; then
32+
: # ok, I guess we'll let you push
33+
# echo "Tag appears signed"
34+
return 0
35+
else
36+
echo "$version tag isn't signed"
37+
echo "Sign it with [git tag -ams\"$version\" $version]"
38+
exit 1
39+
fi
40+
}
41+
42+
while read local_ref local_oid remote_ref remote_oid; do
43+
# Check some things if we're pushing a branch called "release/"
44+
if echo "$remote_ref" | grep ^refs\/heads\/release\/ &> /dev/null ; then
45+
version=$(echo $remote_ref | awk -F/ '{print $NF}')
46+
echo "Looks like you're trying to push a $version release..."
47+
echo "Making sure you've signed and tagged it."
48+
if verify_commit_signed && verify_tag && verify_tag_signed ; then
49+
: # Ok, I guess you can push
50+
else
51+
exit 1
52+
fi
53+
fi
54+
done
55+
256
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
57+
358
git lfs pre-push "$@"

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ assignees: ''
88
---
99

1010
<!-- Please search existing issues to avoid creating duplicates. -->
11+
<!-- Kindly refrain from posting any credentials or sensitive information in this issue -->
1112

1213
## Issue Description
1314
<!-- Provide a summary for your issue/bug. -->

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ assignees: ''
88
---
99

1010
<!-- Please search existing issues to avoid creating duplicates. -->
11+
<!-- Kindly refrain from posting any credentials or sensitive information in this issue -->
1112

1213
## Summary
1314
<!-- Provide a summary to the feature request -->

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ assignees: ''
99

1010
<!-- Please search existing issues to avoid creating duplicates. -->
1111
<!-- Consider starting a [discussion](https://github.com/XRPLF/clio/discussions) instead. -->
12+
<!-- Kindly refrain from posting any credentials or sensitive information in this issue -->
1213

1314
## Question
1415
<!-- Your question -->
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and push Docker image
2+
description: Build and push Docker image to DockerHub and GitHub Container Registry
3+
inputs:
4+
image_name:
5+
description: Name of the image to build
6+
required: true
7+
push_image:
8+
description: Whether to push the image to the registry (true/false)
9+
required: true
10+
directory:
11+
description: The directory containing the Dockerfile
12+
required: true
13+
tags:
14+
description: Comma separated tags to apply to the image
15+
required: true
16+
platforms:
17+
description: Platforms to build the image for (e.g. linux/amd64,linux/arm64)
18+
required: true
19+
description:
20+
description: Short description of the image
21+
required: true
22+
runs:
23+
using: composite
24+
steps:
25+
- name: Login to DockerHub
26+
if: ${{ inputs.push_image == 'true' }}
27+
uses: docker/login-action@v3
28+
with:
29+
username: ${{ env.DOCKERHUB_USER }}
30+
password: ${{ env.DOCKERHUB_PW }}
31+
32+
- name: Login to GitHub Container Registry
33+
if: ${{ inputs.push_image == 'true' }}
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.repository_owner }}
38+
password: ${{ env.GITHUB_TOKEN }}
39+
40+
- uses: docker/setup-qemu-action@v3
41+
- uses: docker/setup-buildx-action@v3
42+
43+
- uses: docker/metadata-action@v5
44+
id: meta
45+
with:
46+
images: ${{ inputs.image_name }}
47+
tags: ${{ steps.generate_tags.outputs.tags }}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: ${{ inputs.directory }}
53+
platforms: ${{ inputs.platforms }}
54+
push: ${{ inputs.push_image == 'true' }}
55+
tags: ${{ steps.meta.outputs.tags }}
56+
57+
- name: Update DockerHub description
58+
if: ${{ inputs.push_image == 'true' }}
59+
uses: peter-evans/dockerhub-description@v4
60+
with:
61+
username: ${{ env.DOCKERHUB_USER }}
62+
password: ${{ env.DOCKERHUB_PW }}
63+
repository: ${{ inputs.image_name }}
64+
short-description: ${{ inputs.description }}
65+
readme-filepath: ${{ inputs.directory }}/README.md
66+

.github/actions/code_coverage/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ runs:
66
- name: Run tests
77
shell: bash
88
run: |
9-
build/clio_tests --backend_host=scylladb
9+
build/clio_tests
1010
1111
- name: Run gcovr
1212
shell: bash
1313
run: |
14-
gcovr -e unittests --xml build/coverage_report.xml -j8 --exclude-throw-branches
14+
gcovr -e tests \
15+
-e src/data/cassandra \
16+
-e src/data/CassandraBackend.hpp \
17+
-e 'src/data/BackendFactory.*' \
18+
--xml build/coverage_report.xml -j8 --exclude-throw-branches
1519
1620
- name: Archive coverage report
17-
uses: actions/upload-artifact@v3
21+
uses: actions/upload-artifact@v4
1822
with:
1923
name: coverage-report.xml
2024
path: build/coverage_report.xml

0 commit comments

Comments
 (0)