mirror of
https://github.com/openssl/openssl.git
synced 2025-12-20 01:22:19 +08:00
add clang-format as a pre-commit hook
Some checks failed
GitHub CI / check_update (push) Has been cancelled
GitHub CI / check_docs (push) Has been cancelled
GitHub CI / check-ansi (push) Has been cancelled
GitHub CI / basic_gcc (push) Has been cancelled
GitHub CI / basic_clang (push) Has been cancelled
GitHub CI / linux-arm64 (push) Has been cancelled
GitHub CI / freebsd-x86_64 (push) Has been cancelled
GitHub CI / minimal (push) Has been cancelled
GitHub CI / no-deprecated (push) Has been cancelled
GitHub CI / no-shared-ubuntu (push) Has been cancelled
GitHub CI / no-shared-macos (push) Has been cancelled
GitHub CI / non-caching (push) Has been cancelled
GitHub CI / address_ub_sanitizer (push) Has been cancelled
GitHub CI / fuzz_tests (push) Has been cancelled
GitHub CI / memory_sanitizer (push) Has been cancelled
GitHub CI / threads_sanitizer (push) Has been cancelled
GitHub CI / enable_non-default_options (push) Has been cancelled
GitHub CI / full_featured (push) Has been cancelled
GitHub CI / no-legacy (push) Has been cancelled
GitHub CI / legacy (push) Has been cancelled
GitHub CI / out-of-readonly-source-and-install-ubuntu (push) Has been cancelled
GitHub CI / out-of-readonly-source-and-install-macos (push) Has been cancelled
GitHub CI / external-tests (push) Has been cancelled
GitHub CI / external-test-pyca (3.9, 1.51.0) (push) Has been cancelled
GitHub CI / external-test-cf-quiche (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-11 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-12 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-13 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-14 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-15 distro:ubuntu-22.04 llvm-ppa-name:jammy]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-16 distro:ubuntu-22.04 llvm-ppa-name:jammy]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-17 distro:ubuntu-22.04 llvm-ppa-name:jammy]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-10 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-11 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-12 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-13 distro:ubuntu-22.04 gcc-ppa-name:ubuntu-toolchain-r/test]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-9 distro:ubuntu-22.04]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:aarch64-linux-gnu libs:libc6-dev-arm64-cross target:linux-aarch64]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:alpha-linux-gnu libs:libc6.1-dev-alpha-cross target:linux-alpha-gcc]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:arm-linux-gnueabi libs:libc6-dev-armel-cross target:linux-armv4 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:arm-linux-gnueabihf libs:libc6-dev-armhf-cross target:linux-armv4 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:hppa-linux-gnu fips:no libs:libc6-dev-hppa-cross target:-static -O1 linux-generic32 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:hppa-linux-gnu libs:libc6-dev-hppa-cross target:linux-generic32 tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:i386-pc-msdosdjgpp libs:libc-djgpp-dev libwatt-djgpp-dev djgpp-utils ppa:jwt27/djgpp-toolchain target:no-threads 386 DJGPP tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:m68k-linux-gnu fips:no libs:libc6-dev-m68k-cross target:-static -m68040 linux-latomic -Wno-stringop-overflow tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:m68k-linux-gnu libs:libc6-dev-m68k-cross target:-mcfv4e -mxgot linux-latomic -Wno-stringop-overflow no-quic tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips-linux-gnu fips:no libs:libc6-dev-mips-cross target:-static linux-mips32 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips-linux-gnu libs:libc6-dev-mips-cross target:linux-mips32 tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips64-linux-gnuabi64 fips:no libs:libc6-dev-mips64-cross target:-static linux64-mips64]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips64-linux-gnuabi64 libs:libc6-dev-mips64-cross target:linux64-mips64 tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mipsel-linux-gnu libs:libc6-dev-mipsel-cross target:linux-mips32 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:powerpc64le-linux-gnu libs:libc6-dev-ppc64el-cross target:linux-ppc64le]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:riscv64-linux-gnu libs:libc6-dev-riscv64-cross target:linux64-riscv64]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:s390x-linux-gnu libs:libc6-dev-s390x-cross target:linux64-s390x -Wno-stringop-overflow]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:sh4-linux-gnu libs:libc6-dev-sh4-cross target:no-async linux-latomic tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:sparc64-linux-gnu libs:libc6-dev-sparc64-cross target:linux64-sparcv9 tests:none]) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:afl-clang-fast config:enable-fuzz-afl no-module install:afl++ name:AFL]) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function -fsanitize-coverage=trace-cmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION extra:enable-fips enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment ena… (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function install:libfuzzer-18-dev libs:--with-fuzzer-lib=/usr/lib/llvm-18/lib/libFuzzer.a --with-fuzzer-include=/usr/include/clang/18/include/fuzzer linke… (push) Has been cancelled
CIFuzz / Fuzzing (push) Has been cancelled
Run-checker CI / run-checker (enable-ssl-trace) (push) Has been cancelled
Run-checker CI / run-checker (enable-trace enable-fips) (push) Has been cancelled
Run-checker CI / run-checker (no-cmp) (push) Has been cancelled
Run-checker CI / run-checker (no-cms) (push) Has been cancelled
Run-checker CI / run-checker (no-default-thread-pool) (push) Has been cancelled
Run-checker CI / run-checker (no-dgram) (push) Has been cancelled
Run-checker CI / run-checker (no-dh) (push) Has been cancelled
Run-checker CI / run-checker (no-dtls) (push) Has been cancelled
Run-checker CI / run-checker (no-ec) (push) Has been cancelled
Run-checker CI / run-checker (no-ecx) (push) Has been cancelled
Run-checker CI / run-checker (no-http) (push) Has been cancelled
Run-checker CI / run-checker (no-legacy) (push) Has been cancelled
Run-checker CI / run-checker (no-quic) (push) Has been cancelled
Run-checker CI / run-checker (no-sock) (push) Has been cancelled
Run-checker CI / run-checker (no-stdio) (push) Has been cancelled
Run-checker CI / run-checker (no-thread-pool) (push) Has been cancelled
Run-checker CI / run-checker (no-threads) (push) Has been cancelled
Run-checker CI / run-checker (no-tls) (push) Has been cancelled
Run-checker CI / run-checker (no-tls1_2) (push) Has been cancelled
Run-checker CI / run-checker (no-tls1_3) (push) Has been cancelled
Run-checker CI / run-checker (no-ui) (push) Has been cancelled
Run-checker merge / run-checker (enable-asan enable-ubsan no-shared no-asm -DOPENSSL_SMALL_FOOTPRINT -fno-sanitize=function) (push) Has been cancelled
Run-checker merge / run-checker (enable-pie) (push) Has been cancelled
Run-checker merge / run-checker (enable-ubsan no-asm -DOPENSSL_SMALL_FOOTPRINT -fno-sanitize=function) (push) Has been cancelled
Run-checker merge / run-checker (enable-weak-ssl-ciphers) (push) Has been cancelled
Run-checker merge / run-checker (enable-zlib) (push) Has been cancelled
Run-checker merge / run-checker (no-ct) (push) Has been cancelled
Run-checker merge / run-checker (no-dso) (push) Has been cancelled
Run-checker merge / run-checker (no-dynamic-engine) (push) Has been cancelled
Run-checker merge / run-checker (no-ec2m enable-fips) (push) Has been cancelled
Run-checker merge / run-checker (no-engine no-shared) (push) Has been cancelled
Run-checker merge / run-checker (no-err) (push) Has been cancelled
Run-checker merge / run-checker (no-filenames) (push) Has been cancelled
Run-checker merge / run-checker (no-integrity-only-ciphers) (push) Has been cancelled
Run-checker merge / run-checker (no-module) (push) Has been cancelled
Run-checker merge / run-checker (no-ocsp) (push) Has been cancelled
Run-checker merge / run-checker (no-pinshared) (push) Has been cancelled
Run-checker merge / run-checker (no-srp) (push) Has been cancelled
Run-checker merge / run-checker (no-srtp) (push) Has been cancelled
Run-checker merge / run-checker (no-ts) (push) Has been cancelled
Run-checker merge / threads_sanitizer_atomic_fallback (push) Has been cancelled
Windows GitHub CI / shared (map[arch:win32 config:--strict-warnings no-fips os:windows-2025]) (push) Has been cancelled
Windows GitHub CI / shared (map[arch:win64 config:enable-fips no-thread-pool no-quic os:windows-2025]) (push) Has been cancelled
Windows GitHub CI / shared (map[arch:win64 config:enable-fips os:windows-2022]) (push) Has been cancelled
Windows GitHub CI / plain (windows-2022) (push) Has been cancelled
Windows GitHub CI / minimal (windows-2022) (push) Has been cancelled
Windows GitHub CI / cygwin (windows-2022, map[arch:win64 config:-DCMAKE_C_COMPILER=gcc --strict-warnings enable-demos no-fips]) (push) Has been cancelled
Windows Compression GitHub CI / zstd (push) Has been cancelled
Windows Compression GitHub CI / brotli (push) Has been cancelled
Some checks failed
GitHub CI / check_update (push) Has been cancelled
GitHub CI / check_docs (push) Has been cancelled
GitHub CI / check-ansi (push) Has been cancelled
GitHub CI / basic_gcc (push) Has been cancelled
GitHub CI / basic_clang (push) Has been cancelled
GitHub CI / linux-arm64 (push) Has been cancelled
GitHub CI / freebsd-x86_64 (push) Has been cancelled
GitHub CI / minimal (push) Has been cancelled
GitHub CI / no-deprecated (push) Has been cancelled
GitHub CI / no-shared-ubuntu (push) Has been cancelled
GitHub CI / no-shared-macos (push) Has been cancelled
GitHub CI / non-caching (push) Has been cancelled
GitHub CI / address_ub_sanitizer (push) Has been cancelled
GitHub CI / fuzz_tests (push) Has been cancelled
GitHub CI / memory_sanitizer (push) Has been cancelled
GitHub CI / threads_sanitizer (push) Has been cancelled
GitHub CI / enable_non-default_options (push) Has been cancelled
GitHub CI / full_featured (push) Has been cancelled
GitHub CI / no-legacy (push) Has been cancelled
GitHub CI / legacy (push) Has been cancelled
GitHub CI / out-of-readonly-source-and-install-ubuntu (push) Has been cancelled
GitHub CI / out-of-readonly-source-and-install-macos (push) Has been cancelled
GitHub CI / external-tests (push) Has been cancelled
GitHub CI / external-test-pyca (3.9, 1.51.0) (push) Has been cancelled
GitHub CI / external-test-cf-quiche (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-11 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-12 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-13 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-14 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-15 distro:ubuntu-22.04 llvm-ppa-name:jammy]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-16 distro:ubuntu-22.04 llvm-ppa-name:jammy]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:clang-17 distro:ubuntu-22.04 llvm-ppa-name:jammy]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-10 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-11 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-12 distro:ubuntu-22.04]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-13 distro:ubuntu-22.04 gcc-ppa-name:ubuntu-toolchain-r/test]) (push) Has been cancelled
Compiler Zoo CI / compiler (map[cc:gcc-9 distro:ubuntu-22.04]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:aarch64-linux-gnu libs:libc6-dev-arm64-cross target:linux-aarch64]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:alpha-linux-gnu libs:libc6.1-dev-alpha-cross target:linux-alpha-gcc]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:arm-linux-gnueabi libs:libc6-dev-armel-cross target:linux-armv4 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:arm-linux-gnueabihf libs:libc6-dev-armhf-cross target:linux-armv4 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:hppa-linux-gnu fips:no libs:libc6-dev-hppa-cross target:-static -O1 linux-generic32 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:hppa-linux-gnu libs:libc6-dev-hppa-cross target:linux-generic32 tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:i386-pc-msdosdjgpp libs:libc-djgpp-dev libwatt-djgpp-dev djgpp-utils ppa:jwt27/djgpp-toolchain target:no-threads 386 DJGPP tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:m68k-linux-gnu fips:no libs:libc6-dev-m68k-cross target:-static -m68040 linux-latomic -Wno-stringop-overflow tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:m68k-linux-gnu libs:libc6-dev-m68k-cross target:-mcfv4e -mxgot linux-latomic -Wno-stringop-overflow no-quic tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips-linux-gnu fips:no libs:libc6-dev-mips-cross target:-static linux-mips32 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips-linux-gnu libs:libc6-dev-mips-cross target:linux-mips32 tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips64-linux-gnuabi64 fips:no libs:libc6-dev-mips64-cross target:-static linux64-mips64]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mips64-linux-gnuabi64 libs:libc6-dev-mips64-cross target:linux64-mips64 tests:none]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:mipsel-linux-gnu libs:libc6-dev-mipsel-cross target:linux-mips32 tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:powerpc64le-linux-gnu libs:libc6-dev-ppc64el-cross target:linux-ppc64le]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:riscv64-linux-gnu libs:libc6-dev-riscv64-cross target:linux64-riscv64]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:s390x-linux-gnu libs:libc6-dev-s390x-cross target:linux64-s390x -Wno-stringop-overflow]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:sh4-linux-gnu libs:libc6-dev-sh4-cross target:no-async linux-latomic tests:-test_includes -test_store -test_x509_store]) (push) Has been cancelled
Cross Compile / cross-compilation (map[arch:sparc64-linux-gnu libs:libc6-dev-sparc64-cross target:linux64-sparcv9 tests:none]) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:afl-clang-fast config:enable-fuzz-afl no-module install:afl++ name:AFL]) (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function -fsanitize-coverage=trace-cmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION extra:enable-fips enable-ec_nistp_64_gcc_128 -fno-sanitize=alignment ena… (push) Has been cancelled
Fuzz-checker CI / fuzz-checker (map[cc:clang-18 config:enable-fuzz-libfuzzer enable-asan enable-ubsan -fno-sanitize=function install:libfuzzer-18-dev libs:--with-fuzzer-lib=/usr/lib/llvm-18/lib/libFuzzer.a --with-fuzzer-include=/usr/include/clang/18/include/fuzzer linke… (push) Has been cancelled
CIFuzz / Fuzzing (push) Has been cancelled
Run-checker CI / run-checker (enable-ssl-trace) (push) Has been cancelled
Run-checker CI / run-checker (enable-trace enable-fips) (push) Has been cancelled
Run-checker CI / run-checker (no-cmp) (push) Has been cancelled
Run-checker CI / run-checker (no-cms) (push) Has been cancelled
Run-checker CI / run-checker (no-default-thread-pool) (push) Has been cancelled
Run-checker CI / run-checker (no-dgram) (push) Has been cancelled
Run-checker CI / run-checker (no-dh) (push) Has been cancelled
Run-checker CI / run-checker (no-dtls) (push) Has been cancelled
Run-checker CI / run-checker (no-ec) (push) Has been cancelled
Run-checker CI / run-checker (no-ecx) (push) Has been cancelled
Run-checker CI / run-checker (no-http) (push) Has been cancelled
Run-checker CI / run-checker (no-legacy) (push) Has been cancelled
Run-checker CI / run-checker (no-quic) (push) Has been cancelled
Run-checker CI / run-checker (no-sock) (push) Has been cancelled
Run-checker CI / run-checker (no-stdio) (push) Has been cancelled
Run-checker CI / run-checker (no-thread-pool) (push) Has been cancelled
Run-checker CI / run-checker (no-threads) (push) Has been cancelled
Run-checker CI / run-checker (no-tls) (push) Has been cancelled
Run-checker CI / run-checker (no-tls1_2) (push) Has been cancelled
Run-checker CI / run-checker (no-tls1_3) (push) Has been cancelled
Run-checker CI / run-checker (no-ui) (push) Has been cancelled
Run-checker merge / run-checker (enable-asan enable-ubsan no-shared no-asm -DOPENSSL_SMALL_FOOTPRINT -fno-sanitize=function) (push) Has been cancelled
Run-checker merge / run-checker (enable-pie) (push) Has been cancelled
Run-checker merge / run-checker (enable-ubsan no-asm -DOPENSSL_SMALL_FOOTPRINT -fno-sanitize=function) (push) Has been cancelled
Run-checker merge / run-checker (enable-weak-ssl-ciphers) (push) Has been cancelled
Run-checker merge / run-checker (enable-zlib) (push) Has been cancelled
Run-checker merge / run-checker (no-ct) (push) Has been cancelled
Run-checker merge / run-checker (no-dso) (push) Has been cancelled
Run-checker merge / run-checker (no-dynamic-engine) (push) Has been cancelled
Run-checker merge / run-checker (no-ec2m enable-fips) (push) Has been cancelled
Run-checker merge / run-checker (no-engine no-shared) (push) Has been cancelled
Run-checker merge / run-checker (no-err) (push) Has been cancelled
Run-checker merge / run-checker (no-filenames) (push) Has been cancelled
Run-checker merge / run-checker (no-integrity-only-ciphers) (push) Has been cancelled
Run-checker merge / run-checker (no-module) (push) Has been cancelled
Run-checker merge / run-checker (no-ocsp) (push) Has been cancelled
Run-checker merge / run-checker (no-pinshared) (push) Has been cancelled
Run-checker merge / run-checker (no-srp) (push) Has been cancelled
Run-checker merge / run-checker (no-srtp) (push) Has been cancelled
Run-checker merge / run-checker (no-ts) (push) Has been cancelled
Run-checker merge / threads_sanitizer_atomic_fallback (push) Has been cancelled
Windows GitHub CI / shared (map[arch:win32 config:--strict-warnings no-fips os:windows-2025]) (push) Has been cancelled
Windows GitHub CI / shared (map[arch:win64 config:enable-fips no-thread-pool no-quic os:windows-2025]) (push) Has been cancelled
Windows GitHub CI / shared (map[arch:win64 config:enable-fips os:windows-2022]) (push) Has been cancelled
Windows GitHub CI / plain (windows-2022) (push) Has been cancelled
Windows GitHub CI / minimal (windows-2022) (push) Has been cancelled
Windows GitHub CI / cygwin (windows-2022, map[arch:win64 config:-DCMAKE_C_COMPILER=gcc --strict-warnings enable-demos no-fips]) (push) Has been cancelled
Windows Compression GitHub CI / zstd (push) Has been cancelled
Windows Compression GitHub CI / brotli (push) Has been cancelled
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29282)
(cherry picked from commit d6f3733f94)
This commit is contained in:
committed by
Neil Horman
parent
0dc35aed6a
commit
6268be68a4
52
.github/workflows/style-checks.yml
vendored
52
.github/workflows/style-checks.yml
vendored
@@ -9,44 +9,22 @@ name: Coding style validation
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-style:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: openssl
|
||||
- name: check style for each commit
|
||||
working-directory: openssl
|
||||
shell: bash
|
||||
run: |
|
||||
ERRORS_FOUND=0
|
||||
git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF
|
||||
REFSTART=$(git rev-parse $GITHUB_BASE_REF)
|
||||
REFEND=$(git rev-parse HEAD)
|
||||
echo "Checking from $REFSTART to $REFEND"
|
||||
echo "::group::Style report for commits $REFSTART..$REFEND"
|
||||
set +e
|
||||
./util/check-format-commit.sh $REFSTART..$REFEND
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ERRORS_FOUND=1
|
||||
fi
|
||||
set -e
|
||||
echo "::endgroup::"
|
||||
SKIP_TEST=$(gh pr view $PR_NUMBER --json labels --jq '.labels[] | select(.name == "style: waived") | .name')
|
||||
if [ -z "$SKIP_TEST" ]
|
||||
then
|
||||
exit $ERRORS_FOUND
|
||||
else
|
||||
echo "PR $PR_NUMBER is marked with style: waived, waiving style check errors"
|
||||
exit 0
|
||||
fi
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-python@v6
|
||||
- name: "Get changed files"
|
||||
env:
|
||||
NUMBER: ${{ github.event.pull_request.number }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
{
|
||||
echo 'CHANGED_FILES<<EOF'
|
||||
gh pr view $NUMBER --json files --jq '.files.[].path'
|
||||
echo EOF
|
||||
} >> "$GITHUB_ENV"
|
||||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
|
||||
with:
|
||||
extra_args: "--files $CHANGED_FILES"
|
||||
|
||||
@@ -1 +1,13 @@
|
||||
repos: []
|
||||
repos:
|
||||
- repo: "https://github.com/codespell-project/codespell"
|
||||
rev: "v2.4.1"
|
||||
hooks:
|
||||
- id: "codespell"
|
||||
args: ["--config=.codespellrc", "."]
|
||||
- repo: "https://github.com/pre-commit/mirrors-clang-format"
|
||||
rev: "v21.1.6"
|
||||
hooks:
|
||||
- id: "clang-format"
|
||||
types_or: []
|
||||
files: '\.c\.in$|\.h\.in$|\.c$|\.h$'
|
||||
args: ["--style=file"]
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License 2.0 (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
# You can obtain a copy in the file LICENSE in the source distribution
|
||||
# or at https://www.openssl.org/source/license.html
|
||||
#
|
||||
# This script is a wrapper around check-format.pl.
|
||||
# It accepts the same commit revision range as 'git diff' as arguments,
|
||||
# or just a single commit id, and uses it to identify the files and line ranges
|
||||
# that were changed in that commit range, filtering check-format.pl output
|
||||
# only to lines that fall into the change ranges of the changed files.
|
||||
# examples:
|
||||
# check-format-commit.sh # check unstaged changes
|
||||
# check-format-commit.sh HEAD
|
||||
# check-format-commit.sh @~3..
|
||||
# check-format-commit.sh f5981c9629667a5a5d6
|
||||
# check-format-commit.sh f5981c9629667a5a5d6..ee0bf38e8709bf71888
|
||||
|
||||
# Allowlist of files to scan
|
||||
# Currently this is any .c or .h file (with an optional .in suffix)
|
||||
FILE_NAME_END_ALLOWLIST=("\.[ch]\(.in\)\?")
|
||||
|
||||
# Global vars
|
||||
|
||||
# TEMPDIR is used to hold any files this script creates
|
||||
# And is cleaned on EXIT with a trap function
|
||||
TEMPDIR=$(mktemp -d /tmp/checkformat.XXXXXX)
|
||||
|
||||
# TOPDIR always points to the root of the git tree we are working in
|
||||
# used to locate the check-format.pl script
|
||||
TOPDIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
|
||||
# cleanup handler function, returns us to the root of the git tree
|
||||
# and erases our temp directory
|
||||
cleanup() {
|
||||
rm -rf $TEMPDIR
|
||||
cd $TOPDIR
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# Get the list of ids of the commits we are checking,
|
||||
# or empty for unstaged changes.
|
||||
# This lets us pass in symbolic ref names like master/etc and
|
||||
# resolve them to commit ids easily
|
||||
COMMIT_RANGE="$@"
|
||||
[ -n $COMMIT_RANGE ] && COMMIT_LAST=$(git rev-parse $COMMIT_RANGE)
|
||||
|
||||
# Fail gracefully if git rev-parse doesn't produce a valid commit
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$1 is not a valid commit range or commit id"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the commit range is exactly one revision,
|
||||
# git rev-parse will output just the commit id of that one alone.
|
||||
# In that case, we must manipulate a little to get a desirable result,
|
||||
# as 'git diff' has a slightly different interpretation of a single commit id:
|
||||
# it takes that to mean all commits up to HEAD, plus any unstaged changes.
|
||||
if [ $(echo -n "$COMMIT_LAST" | wc -w) -ne 1 ]; then
|
||||
COMMIT_LAST=$(echo "$COMMIT_LAST" | head -1)
|
||||
else
|
||||
# $COMMIT_RANGE is just one commit, make it an actual range
|
||||
COMMIT_RANGE=$COMMIT_RANGE^..$COMMIT_RANGE
|
||||
fi
|
||||
|
||||
# Create an iterable list of files to check formatting on,
|
||||
# including the line ranges that are changed by the commits
|
||||
# It produces output of this format:
|
||||
# <file name> <change start line>, <change line count>
|
||||
git diff -U0 $COMMIT_RANGE | awk '
|
||||
BEGIN {myfile=""}
|
||||
/^\+\+\+/ { sub(/^b./,"",$2); file=$2 }
|
||||
/^@@/ { sub(/^\+/,"",$3); range=$3; printf file " " range "\n" }
|
||||
' > $TEMPDIR/ranges.txt
|
||||
|
||||
# filter in anything that matches on a filter regex
|
||||
for i in ${FILE_NAME_END_ALLOWLIST[@]}
|
||||
do
|
||||
# Note the space after the $i below. This is done because we want
|
||||
# to match on file name suffixes, but the input file is of the form
|
||||
# <commit> <file path> <range start>, <range length>
|
||||
# So we can't just match on end of line. The additional space
|
||||
# here lets us match on suffixes followed by the expected space
|
||||
# in the input file
|
||||
grep "$i " $TEMPDIR/ranges.txt >> $TEMPDIR/ranges.filter || true
|
||||
done
|
||||
|
||||
REMAINING_FILES=$(wc -l <$TEMPDIR/ranges.filter)
|
||||
if [ $REMAINING_FILES -eq 0 ]
|
||||
then
|
||||
echo "The given commit range has no C source file changes that require checking"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# unless checking the format of unstaged changes,
|
||||
# check out the files from the commit range.
|
||||
if [ -n "$COMMIT_RANGE" ]
|
||||
then
|
||||
# For each file name in ranges, we show that file at the commit range
|
||||
# we are checking, and redirect it to the same path,
|
||||
# relative to $TEMPDIR/check-format.
|
||||
# This give us the full file path to run check-format.pl on
|
||||
# with line numbers matching the ranges in the $TEMPDIR/ranges.filter file
|
||||
for j in $(awk '{print $1}' $TEMPDIR/ranges.filter | sort -u)
|
||||
do
|
||||
FDIR=$(dirname $j)
|
||||
mkdir -p $TEMPDIR/check-format/$FDIR
|
||||
git show $COMMIT_LAST:$j > $TEMPDIR/check-format/$j
|
||||
done
|
||||
fi
|
||||
|
||||
# Now for each file in $TEMPDIR/ranges.filter, run check-format.pl
|
||||
for j in $(awk '{print $1}' $TEMPDIR/ranges.filter | sort -u)
|
||||
do
|
||||
range_start=()
|
||||
range_end=()
|
||||
|
||||
# Get the ranges for this file. Create 2 arrays. range_start contains
|
||||
# the start lines for valid ranges from the commit. the range_end array
|
||||
# contains the corresponding end line. Note, since diff output gives us
|
||||
# a line count for a change, the range_end[k] entry is actually
|
||||
# range_start[k]+line count
|
||||
for k in $(grep ^$j $TEMPDIR/ranges.filter | awk '{print $2}')
|
||||
do
|
||||
RSTART=$(echo $k | awk -F',' '{print $1}')
|
||||
RLEN=$(echo $k | awk -F',' '{print $2}')
|
||||
# when the hunk is just one line, its length is implied
|
||||
if [ -z "$RLEN" ]; then RLEN=1; fi
|
||||
let REND=$RSTART+$RLEN
|
||||
range_start+=($RSTART)
|
||||
range_end+=($REND)
|
||||
done
|
||||
|
||||
# Go to our checked out tree, unless checking unstaged changes
|
||||
[ -n "$COMMIT_RANGE" ] && cd $TEMPDIR/check-format
|
||||
|
||||
# Actually run check-format.pl on the file, capturing the output
|
||||
# in a temporary file. Note the format of check-format.pl output is
|
||||
# <file path>:<line number>:<error text>:<offending line contents>
|
||||
$TOPDIR/util/check-format.pl $j > $TEMPDIR/results.txt
|
||||
|
||||
# Now we filter the check-format.pl output based on the changed lines
|
||||
# captured in the range_start/end arrays
|
||||
let maxidx=${#range_start[@]}-1
|
||||
for k in $(seq 0 1 $maxidx)
|
||||
do
|
||||
RSTART=${range_start[$k]}
|
||||
REND=${range_end[$k]}
|
||||
|
||||
# field 2 of check-format.pl output is the offending line number
|
||||
# Check here if any line in that output falls between any of the
|
||||
# start/end ranges defined in the range_start/range_end array.
|
||||
# If it does fall in that range, print the entire line to stdout
|
||||
awk -v rstart=$RSTART -v rend=$REND -F':' '
|
||||
/:/ { if (rstart <= $2 && $2 <= rend) print $0 }
|
||||
' $TEMPDIR/results.txt >>$TEMPDIR/results-filtered.txt
|
||||
done
|
||||
done
|
||||
cat $TEMPDIR/results-filtered.txt
|
||||
|
||||
# If any findings were in range, exit with a different error code
|
||||
if [ -s $TEMPDIR/results-filtered.txt ]
|
||||
then
|
||||
exit 2
|
||||
fi
|
||||
1276
util/check-format.pl
1276
util/check-format.pl
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user