Skip to content

Instantly share code, notes, and snippets.

@jordanrobinson
Last active November 24, 2022 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanrobinson/19de4975c4f3a75fdfa3f99956ab6062 to your computer and use it in GitHub Desktop.
Save jordanrobinson/19de4975c4f3a75fdfa3f99956ab6062 to your computer and use it in GitHub Desktop.
code audit bash script
#!/usr/bin/env bash
printf "\n --- $2\n"
git clone "$1" $2 &&
printf "\nCommits on Master: $(cd $2 && git rev-list --count master 2>&1 && cd ..)" &&
printf "\nFirst commit: $(cd $2 && git log --pretty=format:"%h %an %cD %s" --reverse | head -n1 2>&1 && cd ..)\n" &&
printf "\nLines of code:\n\n" &&
cloc $2 &&
printf "\nDependencies:\n\n" &&
printf "Clojure: \n$(cd $2 && lein licenses || echo "N/A" 2>&1 && cd ..)\n\n" || true &&
printf "Javascript: \n$(cd $2 && npm i --silent --no-progress && npx license-report --only=prod --output=csv --fields=name --fields=installedVersion --fields=licenseType || echo "N/A" 2>&1 && cd ..)\n\n" || true &&
printf "PHP: \n$(cd $2 && composer install -n || true && composer licenses -n --no-plugins --no-dev || echo "N/A" 2>&1 && cd ..)\n\n" || true &&
rm -rf $2
@jordanrobinson
Copy link
Author

run it like ./audit.sh git@github.com:org/foo bar where bar is the directory name and title of the output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment