Last active
August 14, 2020 23:45
-
-
Save ioribrn/26f27a937a886b2fcbabb862dddc291b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
################### | |
## notice: | |
## ./codeql.sh setup | set up CodeQL on the host | |
## ./codeql.sh analyze repertoire | clone first, create and analyze a list of repositories. | |
## ./codeql.sh analyze front | |
################### | |
set -e | |
export CODEQL_BIN=/usr/bin/codeql | |
export CODEQL_QUERY=codeql-query | |
setup() { | |
wget https://github.com/github/codeql-cli-binaries/releases/download/v2.2.4/codeql-linux64.zip | |
unzip codeql-linux64.zip | |
sudo mv codeql /usr/bin/codeql | |
git clone https://github.com/github/codeql.git codeql-query | |
rm codeql-linux64.zip | |
echo "✅ CodeQL Ready." | |
} | |
repo="$2" | |
analyze () { | |
mkdir -p repositories reports #databases | |
/usr/bin/codeql/codeql database create $repo-database --language=javascript --source-root=$repo --threads=6 | |
/usr/bin/codeql/codeql database analyze $repo-database codeql-query/javascript/ql/src/ --format=csv --output=reports/$repo.csv | |
} | |
$1 $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment