Skip to content

Commit

Permalink
v0.6.2
Browse files Browse the repository at this point in the history
- Add auto-opening of VSCode
  • Loading branch information
GeekMasher committed Mar 9, 2023
1 parent bcb178e commit 752b5ce
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
11 changes: 1 addition & 10 deletions bin/codeql-upload
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@ export CODEQL_DATABASE_PATHS=$(cat $CODEQL_DATABASE_PATHS_FILE)

if [[ $CODEQL_DATABASE_PATHS != "" ]]; then
debug "Database paths found :: $CODEQL_DATABASE_PATHS"

# for each database path, find sarif file
FILES=""
for CODEQL_DATABASE_PATH in $CODEQL_DATABASE_PATHS; do
SARIF_FILE="$CODEQL_RESULTS/$(basename $CODEQL_DATABASE_PATH).sarif"
debug "Possible SARIF file :: $SARIF_FILE"
if [ -f $SARIF_FILE ]; then
FILES="$FILES $SARIF_FILE"
fi
done
FILES=$(get-sarif-files $CODEQL_DATABASE_PATHS_FILE)
else
info "Uploading all SARIF files found in :: $CODEQL_RESULTS"
FILES=$(find $CODEQL_RESULTS -type f -name "*.sarif")
Expand Down
12 changes: 12 additions & 0 deletions bin/codeql-utils
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,15 @@ codeql-install() {

info "CodeQL installed!"
}

get-sarif-files() {
# return a list of SARIF files based on database names
DATABASE_PATHS=$(cat $1)
for CODEQL_DATABASE_PATH in $DATABASE_PATHS; do
SARIF_FILE="$CODEQL_RESULTS/$(basename $CODEQL_DATABASE_PATH).sarif"
debug "Possible SARIF file :: $SARIF_FILE"
if [ -f $SARIF_FILE ]; then
echo "$SARIF_FILE"
fi
done
}
12 changes: 11 additions & 1 deletion gh-codeql-scan
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export EXTENSION_LOCATION="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
source $EXTENSION_LOCATION/bin/codeql-utils

# >> CodeQL Scan
export CODEQL_SCAN_VERSION="0.6.1"
export CODEQL_SCAN_VERSION="0.6.2"
# enabled by default
export CODEQL_SCAN_BANNER=1

Expand Down Expand Up @@ -109,6 +109,10 @@ for i in "$@"; do
export WORKSPACE="${i#*=}"
shift
;;
--view-in-vscode)
export CODEQL_VIEW_IN_VSCODE=1
shift
;;
# -*|--*)
# echo "Unknown option $i"
# exit 1
Expand Down Expand Up @@ -200,4 +204,10 @@ elif [ $MODE = "scan" ]; then
fi
fi


if [ "$CODEQL_VIEW_IN_VSCODE" = "1" ]; then
info "Opening results in VSCode..."
code -r $(get-sarif-files $CODEQL_DATABASE_PATHS_FILE)
fi

info "Completed CodeQL Scan!"

0 comments on commit 752b5ce

Please sign in to comment.