Package: bugout-locust
locust"It'sgit diff --staton steroids!" -@scottmillikenWhat is Locust?Locust helps you reason about your code base as it evolves over time.Locust provides a semantic layer on top ofgit diff. It emits metadata describingAST-level changes to your
code base between git revisions.This metadata is useful to both humans and computers. For example:(Humans) Locust can generatemuch more humane summaries of changesthan the
standard git diff.(Computers)Bugout.devuses Locust metadata to learn high level
abstractions about code.InstallationLocust requires Python3 (specifically, it was written in Python3.8).Install from PyPIpipinstall-Usetuptools
pipinstallbugout-locustInstall from sourceClone this repository and run from the project root:pythonsetup.pyinstallDockerYou can also use the Locust docker image:dockerpullbugout/locustUsageCLILocust is a command line tool, and you can invoke it as:locust22dd7fd6adf392bb29d13d10f10e7dbb1d97bfcec9813bd5871a9919551ccd917712135c40367c5c--formatyamlThis produces the following output:locust:-file:locust/ci_helpers/github.pychanges:-name:generate_argument_parsertype:functionline:11changed_lines:9total_lines:9children:[]-name:helper_pushtype:functionline:22changed_lines:13total_lines:13children:[]-name:helper_prtype:functionline:37changed_lines:14total_lines:14children:[]-name:maintype:functionline:53changed_lines:29total_lines:29children:[]refs:initial:22dd7fdterminal:c9813bdLanguage pluginsTo use Locust to process a code base containing Python (>3.5) and Javascript, use the Javascript
plugin (written in Node 14).If you are running Locust from the root of this project, you would do this as follows:locust -r <path to repo> <initial revision> <terminal revision> --plugins "node js/out/index.js"A Locust language plugin is simply a program that you can invoke from the shell (likenode js/out/index.js) which takes two arguments:-i- an input file containing alocust.git.RunResponseobject-o- path to an output file into which it writes a list of tuples consisting oflocust.git.PatchInfoobjects and their corresponding list oflocust.parse.RawDefinitionobjects.TheJavascript pluginprovides a rubric for how to build your own plugin.You can add custom plugins to a Locust invocation like this:locust -r <path to repo> <initial revision> <terminal revision> \
  --plugins "node js/out/index.js" "<custom plugin invocation 1>" "<custom plugin invocation 2>"CI/CDLocust is easy to use in CI/CD pipelines:Locust GitHub ActionBugout App integrationYou can use Locust with ourBugout GitHub Bot.
Locust extension will work after you push./github/workflows/locust.ymlfile inmainbranch:name:Locust summaryon:[pull_request_target]jobs:build:runs-on:ubuntu-20.04steps:-name:PR head repoid:head_repo_namerun:|HEAD_REPO_NAME=$(jq -r '.pull_request.head.repo.full_name' "$GITHUB_EVENT_PATH")echo "PR head repo: $HEAD_REPO_NAME"echo "::set-output name=repo::$HEAD_REPO_NAME"-name:Checkout git repouses:actions/checkout@v2with:repository:${{ steps.head_repo_name.outputs.repo }}fetch-depth:0-name:Install pythonuses:actions/setup-python@v2with:python-version:"3.8"-name:Install dependenciesrun:|python -m pip install --upgrade pip setuptoolspip install bugout-locust-name:Generate and send Locust summaryenv:BUGOUT_SECRET:${{ secrets.BUGOUT_SECRET }}run:|locust.github publishBUGOUT_SECRET should be setted up in repository/organization secrets. Value you can take from Bugout Account token page. AlsoBUGOUT_API_URL: ${{ secrets.BUGOUT_API_URL }}could be specified if you want to setup your personal server for processing locust summaries.DockerTo run Locust using docker:dockerrun-v$ABSOLUTE_PATH_TO_GIT_REPO:/usr/src/appbugout/locust-r/usr/src/app\$INITIAL_REVISION\$TERMINAL_REVISION\--formatyamlOutput formatsLocust can produce output in many formats. The currently supported formats are:JSON (--format json)YAML (--format yaml)HTML (--format html)GitHub-flavored HTML, meant to be used with GitHub styles (--format html-github)ContributingRunning testsMake sure to clonesimiotics/locust-test-casesrepo to your machine.Run:git-c<pathtolocust-test-casesrepo>fetchoriginThen, from the root of this repo:LOCUST_TESTCASES_DIR=<pathtolocust-test-casesrepo>./test.shSimilar projectsKytheKytheis a Google open source project. It grew out of the need to semantically
link different parts of Google's code base.The goals of Locust are different from those of Kythe. Locust is specifically about generating
metadata describingchangesto code.Kythe on GitHub:https://github.com/kythe/kythe