mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
Add infrastructure for snapshotting evaluation results created from indexing a sample project.
This PR adds a Java project (testdata/java), but extending to more languages should be trivial.
Most complex part of the build is creating SCIP indexes from test repositories using Bazel.
Refactoring and code changes:
We don't really have any evaluation options yet, so no need to pass them around. What we do have is options that affect output
Extract symbol formatter and path formatter into separate objects - we don't need to pass entire evaluator around if all we care about is consistent interning of symbols
Explicitly pass around a writable interface instead of throwing everything into stderr
Add ability to disable color output
Make evaluation summary serializable
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
echo "--- shellcheck"
|
|
|
|
trap "echo ^^^ +++" ERR
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
|
|
|
|
SHELL_SCRIPTS=()
|
|
|
|
# ignore dev/sg/internal/usershell/autocomplete which just houses scripts copied from elsewhere
|
|
IGNORE_AUTOCOMPLETE="dev/sg/internal/usershell/autocomplete"
|
|
# ignore client/jetbrains since the shell scripts are created by gradle and not maintained by us
|
|
IGNORE_JETBRAINS="client/jetbrains"
|
|
# ignore SCIP treesitter CLI as gradle scripts are generated
|
|
IGNORE_SCIP_TREESITTER_CLI="docker-images/syntax-highlighter/crates/scip-treesitter-cli"
|
|
|
|
GREP_IGNORE_FILES="$IGNORE_AUTOCOMPLETE\|$IGNORE_JETBRAINS\|$IGNORE_SCIP_TREESITTER_CLI"
|
|
|
|
while IFS='' read -r line; do SHELL_SCRIPTS+=("$line"); done < <(comm -12 <(git ls-files | sort) <(shfmt -f . | grep -v $GREP_IGNORE_FILES | sort))
|
|
|
|
set +e
|
|
OUT=$(shellcheck --external-sources --source-path="SCRIPTDIR" --color=always "${SHELL_SCRIPTS[@]}")
|
|
EXIT_CODE=$?
|
|
set -e
|
|
echo -e "$OUT"
|
|
|
|
if [ $EXIT_CODE -ne 0 ]; then
|
|
mkdir -p ./annotations
|
|
echo -e "$OUT" >./annotations/shellcheck
|
|
echo "^^^ +++"
|
|
fi
|
|
|
|
exit $EXIT_CODE
|