-
Notifications
You must be signed in to change notification settings - Fork 23
/
soundness.sh
executable file
·57 lines (49 loc) · 1.61 KB
/
soundness.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftOpenAPIGenerator open source project
##
## Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
set -euo pipefail
log() { printf -- "** %s\n" "$*" >&2; }
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
fatal() { error "$@"; exit 1; }
CURRENT_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
NUM_CHECKS_FAILED=0
export DOCC_TARGET=OpenAPIURLSession
FIX_FORMAT=""
for arg in "$@"; do
if [ "$arg" == "--fix" ]; then
FIX_FORMAT="--fix"
fi
done
SCRIPT_PATHS=(
"${CURRENT_SCRIPT_DIR}/check-for-broken-symlinks.sh"
"${CURRENT_SCRIPT_DIR}/check-for-unacceptable-language.sh"
"${CURRENT_SCRIPT_DIR}/check-license-headers.sh"
"${CURRENT_SCRIPT_DIR}/check-for-docc-warnings.sh"
)
for SCRIPT_PATH in "${SCRIPT_PATHS[@]}"; do
log "Running ${SCRIPT_PATH}..."
if ! bash "${SCRIPT_PATH}"; then
((NUM_CHECKS_FAILED+=1))
fi
done
log "Running swift-format..."
bash "${CURRENT_SCRIPT_DIR}"/run-swift-format.sh $FIX_FORMAT > /dev/null
FORMAT_EXIT_CODE=$?
if [ $FORMAT_EXIT_CODE -ne 0 ]; then
((NUM_CHECKS_FAILED+=1))
fi
if [ "${NUM_CHECKS_FAILED}" -gt 0 ]; then
fatal "❌ ${NUM_CHECKS_FAILED} soundness check(s) failed."
fi
log "✅ All soundness check(s) passed."