From ff33208bf5d9bccd576e22fd8922f07e78d51298 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Tue, 19 Jul 2022 14:05:30 +0800 Subject: [PATCH] docs: Add docs for manual testing + submitting PRs. --- scip-ruby.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/scip-ruby.md b/scip-ruby.md index ca9b1d24aa..6dc4c06673 100644 --- a/scip-ruby.md +++ b/scip-ruby.md @@ -33,6 +33,29 @@ Updating snapshots ./bazel test //test/scip:update --config=dbg ``` +## Manually testing against larger codebases + +Some OSS repos that can be used to exercise scip-ruby are: +- [Homebrew/brew](https://github.com/Homebrew/brew): (150k SLOC) + 1. Clone and run `./bin/brew typecheck` once. + 2. Copy over the built `scip-ruby` binary: + ``` + cp /path/to/scip-ruby ./Library/Homebrew/vendor/bundle/ruby/2.6.0/bin/srb + ``` + 3. Add a line for indexing + ``` + diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb + index b9f00a544..aac977019 100644 + --- a/Library/Homebrew/dev-cmd/typecheck.rb + +++ b/Library/Homebrew/dev-cmd/typecheck.rb + @@ -124,2 +124,3 @@ module Homebrew + end + + srb_exec += ["--index-file", "index.scip", "--gem-metadata", "brew@3.5.4"] + success = system(*srb_exec) + ``` + 4. Run `./bin/brew typecheck`. An index should appear under `Library/Homebrew/`. + 5. Go to step 2. + ## Debugging So far, I've mostly been using print debugging @@ -57,3 +80,18 @@ file under the `test/scip/snapshots/` directory # View output ./bazel test //test/scip:update_tmp --config=dbg && cat test/scip/testdata/tmp.snapshot.rb ``` + +Having the [SCIP CLI](https://github.com/sourcegraph/scip) available +is also useful for inspecting the emitted index. + +## Creating PRs + +PRs created through the GitHub UI default to being made +against the upstream Sorbet repo. It is less error-prone +to use the [GitHub CLI](https://cli.github.com/) instead. + +``` +gh pr create -R sourcegraph/scip-ruby +``` + +This will correctly use the `scip-ruby/master` branch as the target.