mirror of
https://github.com/luxfi/sdk.git
synced 2026-10-30 15:19:23 +00:00
Lux Partners Limited is not the entity behind this work. Every place the old name stood — copyright lines, site footers, brand config, legal and compliance text — now names the company that actually holds it. lux.fund is the exception and is not renamed to match: that site belongs to Lux Assets Management LLC, a different company, and it says so. Two kinds of line were left for a person rather than rewritten. A dated news item recording that Lux Partners Limited was established in the Isle of Man is a historical fact, and renaming it would falsify the record. And a sentence asserting that the company is domiciled in the Isle of Man is a claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle of Man company, so swapping the name there would assert something untrue. Co-authored-by: Hanzo Dev <[email protected]>
77 lines
1.9 KiB
Bash
Executable File
77 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright (C) 2023-2025, Lux Industries Inc. All rights reserved.
|
|
# See the file LICENSE for licensing terms.
|
|
|
|
|
|
set -o errexit
|
|
set -o pipefail
|
|
set -e
|
|
|
|
if ! [[ "$0" =~ scripts/tests.lint.sh ]]; then
|
|
echo "must be run from repository root"
|
|
exit 255
|
|
fi
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
# by default, check all source code
|
|
# to test only "mempool" package
|
|
# ./scripts/lint.sh ./mempool/...
|
|
TARGET="./..."
|
|
else
|
|
TARGET="${1}"
|
|
fi
|
|
|
|
# by default, "./scripts/lint.sh" runs all lint tests
|
|
# to run only "license_header" test
|
|
# TESTS='license_header' ./scripts/lint.sh
|
|
TESTS=${TESTS:-"golangci_lint license_header"}
|
|
|
|
# https://github.com/golangci/golangci-lint/releases
|
|
function test_golangci_lint {
|
|
go install -v github.com/golangci/golangci-lint/v2/cmd/[email protected]
|
|
golangci-lint run --config .golangci.yml
|
|
}
|
|
|
|
# find_go_files [package]
|
|
# all go files except generated ones
|
|
function find_go_files {
|
|
local target="${1}"
|
|
go fmt -n "${target}" | grep -Eo "([^ ]*)$" | grep -vE "(\\.pb\\.go|\\.pb\\.gw.go)"
|
|
}
|
|
|
|
# automatically checks license headers
|
|
# to modify the file headers (if missing), remove "--check" flag
|
|
# TESTS='license_header' ADDLICENSE_FLAGS="-v" ./scripts/lint.sh
|
|
_addlicense_flags=${ADDLICENSE_FLAGS:-"--check -v"}
|
|
function test_license_header {
|
|
go install -v github.com/google/addlicense@latest
|
|
local target="${1}"
|
|
local files=()
|
|
while IFS= read -r line; do files+=("$line"); done < <(find_go_files "${target}")
|
|
|
|
# ignore 3rd party code
|
|
addlicense \
|
|
-f ./LICENSE.header \
|
|
${_addlicense_flags} \
|
|
"${files[@]}"
|
|
}
|
|
|
|
function run {
|
|
local test="${1}"
|
|
shift 1
|
|
echo "START: '${test}' at $(date)"
|
|
if "test_${test}" "$@" ; then
|
|
echo "SUCCESS: '${test}' completed at $(date)"
|
|
else
|
|
echo "FAIL: '${test}' failed at $(date)"
|
|
exit 255
|
|
fi
|
|
}
|
|
|
|
echo "Running '$TESTS' at: $(date)"
|
|
for test in $TESTS; do
|
|
run "${test}" "${TARGET}"
|
|
done
|
|
|
|
echo "ALL SUCCESS!"
|