Evaluation results snasphots (#58500)

Add infrastructure for snapshotting evaluation results created from indexing a sample project.
This PR adds a Java project (testdata/java), but extending to more languages should be trivial.
Most complex part of the build is creating SCIP indexes from test repositories using Bazel.

Refactoring and code changes:

    We don't really have any evaluation options yet, so no need to pass them around. What we do have is options that affect output
    Extract symbol formatter and path formatter into separate objects - we don't need to pass entire evaluator around if all we care about is consistent interning of symbols
    Explicitly pass around a writable interface instead of throwing everything into stderr
    Add ability to disable color output
    Make evaluation summary serializable
This commit is contained in:
Anton Sviridov 2024-01-26 15:14:44 +00:00 committed by GitHub
parent a01274d81b
commit 3bc52d0a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 1079 additions and 137 deletions

View File

@ -46,6 +46,7 @@ common --test_env=INCLUDE_ADMIN_ONBOARDING=false
# Used for container_structure_tests
common --test_env=DOCKER_HOST
common --action_env=DOCKER_HOST
# Used by migration rules
common --action_env=PGUSER=postgres
@ -53,4 +54,3 @@ common --action_env=PGUSER=postgres
# This overrides the same flag set in ci.bazelrc. Note that if for some reason this bazelrc is loaded before ci.bazelrc,
# then the ci.bazelrc will override this one.
test --flaky_test_attempts=2

View File

@ -11,8 +11,13 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/../..
SHELL_SCRIPTS=()
# ignore dev/sg/internal/usershell/autocomplete which just houses scripts copied from elsewhere
IGNORE_AUTOCOMPLETE="dev/sg/internal/usershell/autocomplete"
# ignore client/jetbrains since the shell scripts are created by gradle and not maintained by us
GREP_IGNORE_FILES="dev/sg/internal/usershell/autocomplete\|client/jetbrains"
IGNORE_JETBRAINS="client/jetbrains"
# ignore SCIP treesitter CLI as gradle scripts are generated
IGNORE_SCIP_TREESITTER_CLI="docker-images/syntax-highlighter/crates/scip-treesitter-cli"
GREP_IGNORE_FILES="$IGNORE_AUTOCOMPLETE\|$IGNORE_JETBRAINS\|$IGNORE_SCIP_TREESITTER_CLI"
while IFS='' read -r line; do SHELL_SCRIPTS+=("$line"); done < <(comm -12 <(git ls-files | sort) <(shfmt -f . | grep -v $GREP_IGNORE_FILES | sort))

View File

@ -208,6 +208,12 @@ def oci_deps():
image = "index.docker.io/sourcegraph/wolfi-qdrant-base",
)
oci_pull(
name = "scip-java",
digest = "sha256:aa63f38a0dacfa1371ea701937f519347d4c0bca7628389aeb7173c042483ebb",
image = "index.docker.io/sourcegraph/scip-java",
)
# The following image digests are from tag 252535_2023-11-28_5.2-82b5f4f5d73f. sg wolfi update-hashes DOES NOT update these digests.
# To rebuild these legacy images using docker and outside of bazel you can either push a branch to:
# - docker-images-candidates-notest/<your banch name here>

View File

@ -0,0 +1 @@
!testdata/java/index.scip

View File

@ -1,5 +1,6 @@
load("@crate_index//:defs.bzl", "aliases", "all_crate_deps")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
rust_binary(
name = "scip-treesitter",
@ -70,14 +71,20 @@ rust_test(
],
allow_empty = False,
),
data = [":scip-treesitter"] +
glob(
["tests/snapshots/**"],
allow_empty = False,
),
data = [
":java_groundtruth_scip",
":scip-treesitter",
] + glob(
["tests/snapshots/**"],
allow_empty = False,
) + glob(
["testdata/**"],
allow_empty = False,
),
env = {
"INSTA_WORKSPACE_ROOT": ".",
"RUST_BACKTRACE": "1",
"JAVA_SCIP_INDEX": "$(rootpath :java_groundtruth_scip)",
"SCIP_TREESITTER_PATH": "$(rootpath :scip-treesitter)",
},
deps = all_crate_deps(
@ -87,3 +94,27 @@ rust_test(
":scip-treesitter-cli-lib",
] + WORKSPACE_DEPS,
)
oci_image(
name = "scip_java_image",
base = "@scip-java",
)
oci_tarball(
name = "scip_java_image_tarball",
image = ":scip_java_image",
repo_tags = ["scip-java:tmp"],
)
genrule(
name = "java_groundtruth_scip",
srcs = [
"testdata/scip-index.sh",
":scip_java_image_tarball",
] + glob(["testdata/java/**"]),
outs = ["index-java.scip"],
cmd = """\
$(location testdata/scip-index.sh) $(location :scip_java_image_tarball) scip-java:tmp $(location testdata/java/build.gradle) 'scip-java index' $@
""",
tags = ["requires-network"],
)

View File

@ -5,7 +5,11 @@
- [Usage](#usage)
- [Indexing](#indexing)
- [Evaluation](#evaluation)
- [Contributing](#contributing)
- [Development](#development)
- [Running tests](#running-tests)
- [Generating local reference SCIP files](#generating-local-reference-scip-files)
- [Build the CLI for local testing](#build-the-cli-for-local-testing)
- [Run the locally built CLI](#run-the-locally-built-cli)
<!--toc:end-->
A command line tool that uses other scip-* crates to either
@ -20,18 +24,18 @@ A command line tool that uses other scip-* crates to either
Index a list of files:
```bash
scip-treesitter-cli index --language java --out ./index.scip file1.java file2.java ...
scip-treesitter index --language java --out ./index.scip file1.java file2.java ...
```
Index a folder recursively:
```bash
scip-treesitter-cli index --language java --out ./index.scip --workspace <some-folder>
scip-treesitter index --language java --out ./index.scip --workspace <some-folder>
```
### Evaluation
```bash
scip-treesitter-cli evaluate --candidate index-tree-sitter.scip --ground-truth index.scip
scip-treesitter evaluate --candidate index-tree-sitter.scip --ground-truth index.scip
```
## Development
@ -43,6 +47,45 @@ but Cargo usage is also supported for convenience.
### Running tests
#### Generating local reference SCIP files
To run the tests locally (in particular evaluation tests) without Bazel, you first need to produce the reference SCIP files
by using SCIP indexers.
If you run tests through Bazel, then you don't need to do anything extra - the
SCIP generation is wired as part of `integration_test` target.
The setup for tests is required to work with both Bazel and Cargo, and so here's how we do it:
1. The reference SCIP files are generated entirely by Bazel (see below)
2. Each testdata language folder contains a symlink named `index.scip` that
points to a stable location where Bazel puts binary artifacts.
e.g.
```
testdata/java/index.scip -> ../../../../../../bazel-bin/docker-images/syntax-highlighter/crates/scip-treesitter-cli/index-java.scip
```
3. The code is written in such a way to fallback to a local `index.scip` file unless
Bazel-specific environment variables are set up.
To generate reference SCIP files locally, it's recommended to run the `integration_test` target
once:
```
bazel test //docker-images/syntax-highlighter/crates/scip-treesitter-cli:integration_test
```
Or if you prefer, run individual tasks:
```
bazel build //docker-images/syntax-highlighter/crates/scip-treesitter-cli:java_groundtruth_scip
```
After that you can use `cargo test`, or continue to run tests through Bazel (which is what
CI does).
```bash
cargo test
```

View File

@ -1,8 +1,5 @@
use clap::{Parser, Subcommand};
use scip_treesitter_cli::{
evaluate::ScipEvaluateOptions,
index::{index_command, AnalysisMode, IndexMode, IndexOptions},
};
use scip_treesitter_cli::index::{index_command, AnalysisMode, IndexMode, IndexOptions};
use std::path::PathBuf;
#[derive(Parser)]
@ -77,6 +74,10 @@ enum Commands {
/// Print all occurrences in ground truth SCIP that don't match any occurrences in candidate SCIP
#[arg(long)]
print_false_negatives: bool,
/// Disable color output
#[arg(long, default_value_t = false, long = "no-color")]
disable_colors: bool,
},
}
@ -142,14 +143,16 @@ pub fn main() {
print_true_positives,
print_false_positives,
print_false_negatives,
disable_colors,
} => scip_treesitter_cli::evaluate::evaluate_command(
PathBuf::from(candidate),
PathBuf::from(ground_truth),
ScipEvaluateOptions {
scip_treesitter_cli::evaluate::EvaluationOutputOptions {
print_mapping,
print_true_positives,
print_false_positives,
print_false_negatives,
disable_colors,
},
),
}

View File

@ -8,18 +8,24 @@ use std::{
};
use anyhow::*;
use colored::Colorize;
use colored::{ColoredString, Colorize};
use scip::types::Index;
use syntax_analysis::range::PackedRange;
use serde::Serializer;
use string_interner::{symbol::SymbolU32, StringInterner, Symbol};
use syntax_analysis::range::PackedRange;
use crate::{io::read_index_from_file, progress::*};
pub fn evaluate_command(candidate: PathBuf, ground_truth: PathBuf, options: ScipEvaluateOptions) {
pub fn evaluate_command(
candidate: PathBuf,
ground_truth: PathBuf,
evaluation_output_options: EvaluationOutputOptions,
) {
Evaluator::default()
.evaluate_files(candidate, ground_truth, options)
.evaluate_files(candidate, ground_truth)
.unwrap()
.write_summary(&mut std::io::stdout(), evaluation_output_options)
.unwrap()
.print_summary()
}
fn validate_index(idx: &Index) -> Result<()> {
@ -40,7 +46,7 @@ fn validate_index(idx: &Index) -> Result<()> {
// These unfortunately don't help the typesafety and are only here to aid readability
// TODO: newtype https://doc.rust-lang.org/book/ch19-03-advanced-traits.html#using-the-newtype-pattern-to-implement-external-traits-on-external-types
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)]
struct PathId {
value: SymbolU32,
}
@ -125,38 +131,59 @@ struct ClassifiedLocation {
}
#[derive(Clone, Copy, Default, Debug)]
pub struct ScipEvaluateOptions {
pub struct EvaluationOutputOptions {
pub print_mapping: bool,
pub print_true_positives: bool,
pub print_false_positives: bool,
pub print_false_negatives: bool,
pub disable_colors: bool,
}
fn round_serialize<S>(x: &f32, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
s.serialize_str(format!("{:.1}", x).as_str())
}
#[derive(serde::Serialize, Debug)]
pub struct EvaluationSummary {
#[serde(serialize_with = "round_serialize")]
pub precision_percent: f32,
#[serde(serialize_with = "round_serialize")]
pub recall_percent: f32,
#[serde(serialize_with = "round_serialize")]
pub true_positives: f32,
#[serde(serialize_with = "round_serialize")]
pub false_positives: f32,
#[serde(serialize_with = "round_serialize")]
pub false_negatives: f32,
}
#[derive(Debug)]
pub struct EvaluationResult<'e> {
evaluator: &'e Evaluator,
// evaluator: &'e Evaluator,
path_formatter: &'e mut PathFormatter,
symbol_formatter: &'e mut SymbolFormatter,
summary: EvaluationSummary,
symbol_mapping: SymbolMapping,
true_positives: Vec<SymbolOccurrence>,
false_positives: Vec<SymbolOccurrence>,
false_negatives: Vec<SymbolOccurrence>,
// What options were used for this evaluation
options: ScipEvaluateOptions,
}
#[derive(Debug)]
struct SymbolMapping {
candidate_sets: HashMap<SymbolId<Candidate>, HashMap<SymbolId<GroundTruth>, Overlap>>,
symbol_pair_weight: HashMap<SymbolPair, f32>,
}
impl<'e> EvaluationResult<'e> {
fn new<'a>(
evaluator: &'a Evaluator,
evaluator: &'a mut Evaluator,
classified: Vec<ClassifiedLocation>,
options: ScipEvaluateOptions,
symbol_mapping: SymbolMapping,
) -> EvaluationResult<'a> {
let mut true_positives_occurrences: Vec<SymbolOccurrence> = Vec::new();
let mut false_positives_occurrences: Vec<SymbolOccurrence> = Vec::new();
@ -190,8 +217,21 @@ impl<'e> EvaluationResult<'e> {
let precision = 100.0 * true_positives / (true_positives + false_positives);
let recall = 100.0 * true_positives / (true_positives + false_negatives);
let sorter = |occ: &SymbolOccurrence| {
(
occ.location.path_id,
occ.location.rng.start_line,
occ.location.rng.start_col,
)
};
true_positives_occurrences.sort_by_key(sorter);
false_negatives_occurrences.sort_by_key(sorter);
false_positives_occurrences.sort_by_key(sorter);
EvaluationResult {
evaluator,
symbol_formatter: &mut evaluator.symbol_formatter,
path_formatter: &mut evaluator.path_formatter,
summary: EvaluationSummary {
precision_percent: precision,
recall_percent: recall,
@ -202,88 +242,173 @@ impl<'e> EvaluationResult<'e> {
true_positives: true_positives_occurrences,
false_positives: false_positives_occurrences,
false_negatives: false_negatives_occurrences,
options,
symbol_mapping,
}
}
}
impl<'e> EvaluationResult<'e> {
pub fn print_summary(&self) {
println!("{}", serde_json::to_string(&self.summary).unwrap());
fn write_occ<W: std::io::Write>(
&self,
label: &str,
occ: &SymbolOccurrence,
output: &mut W,
) -> anyhow::Result<()> {
writeln!(
output,
"[{label}] {}: L{} C{} -- {}",
self.path_formatter.display_path(occ.location.path_id),
occ.range().start_line,
occ.range().start_col,
self.symbol_formatter.display_symbol(occ.symbol)
)?;
let print_occ = |occ: &SymbolOccurrence| {
eprintln!(
"{}: L{} C{} -- {}",
self.evaluator.display_path(occ.location.path_id),
occ.range().start_line,
occ.range().start_col,
self.evaluator.display_symbol(occ.symbol),
);
};
Ok(())
}
if self.options.print_false_negatives {
eprintln!();
fn render(&self, str: ColoredString, options: EvaluationOutputOptions) -> ColoredString {
if options.disable_colors {
str.normal()
} else {
str
}
}
eprintln!(
"{}: {}",
"False negatives".red(),
self.false_negatives.len().to_string().bold()
);
eprintln!(
fn write_mapping<W: std::io::Write>(
&mut self,
output: &mut W,
options: EvaluationOutputOptions,
) -> anyhow::Result<()> {
let mut candidate_mapping_vec: Vec<(
SymbolId<Candidate>,
HashMap<SymbolId<GroundTruth>, Overlap>,
)> = self
.symbol_mapping
.candidate_sets
.clone()
.into_iter()
.collect();
candidate_mapping_vec.sort_by_key(|(sym, _)| *sym);
for (candidate_symbol, alternatives) in candidate_mapping_vec.into_iter() {
let candidate = self
.symbol_formatter
.try_strip_package_details(candidate_symbol);
let mut alternatives_vec: Vec<(SymbolId<GroundTruth>, Overlap)> =
alternatives.into_iter().collect();
alternatives_vec.sort_by_key(|(sym, _)| *sym);
writeln!(
output,
"{}",
"How many actual occurrences we DIDN'T find compared to compiler?".italic()
);
self.render(
self.symbol_formatter.display_symbol(candidate).red(),
options
)
)?;
for (ground_truth_symbol, overlap) in &alternatives_vec {
let ground_truth = self
.symbol_formatter
.try_strip_package_details(*ground_truth_symbol);
let adjusted_weight = self
.symbol_mapping
.symbol_pair_weight
.get(&SymbolPair {
candidate: candidate_symbol,
ground_truth: *ground_truth_symbol,
})
.unwrap();
writeln!(
output,
" {:.2} {} [{}/{} occurrences]",
adjusted_weight,
self.render(
self.symbol_formatter.display_symbol(ground_truth).green(),
options
),
overlap.common,
overlap.total
)?;
}
writeln!(output)?;
}
Ok(())
}
pub fn write_summary<W: std::io::Write>(
&mut self,
output: &mut W,
options: EvaluationOutputOptions,
) -> anyhow::Result<()> {
writeln!(output, "{}", serde_json::to_string(&self.summary)?)?;
if options.print_false_negatives && !self.false_negatives.is_empty() {
writeln!(output)?;
writeln!(
output,
"{}: {}",
self.render("False negatives (FN)".red(), options),
self.render(self.false_negatives.len().to_string().bold(), options)
)?;
for symbol_occurrence in &self.false_negatives {
print_occ(symbol_occurrence);
self.write_occ("FN", symbol_occurrence, output)?;
}
}
if self.options.print_false_positives {
eprintln!();
eprintln!(
if options.print_false_positives && !self.false_positives.is_empty() {
writeln!(output)?;
writeln!(
output,
"{}: {}",
"False positives".red(),
self.false_positives.len().to_string().bold()
);
eprintln!(
self.render("False positives".red(), options),
self.render(self.false_positives.len().to_string().bold(), options)
)?;
writeln!(
output,
"{}",
"How many extra occurrences we reported compared to compiler?".italic()
);
)?;
for symbol_occurrence in &self.false_positives {
print_occ(symbol_occurrence);
self.write_occ("FP", symbol_occurrence, output)?;
}
}
if self.options.print_true_positives {
eprintln!();
eprintln!(
if options.print_true_positives {
writeln!(output)?;
writeln!(
output,
"{}: {}",
"True positives".green(),
self.true_positives.len().to_string().bold()
);
self.render("True positives".green(), options),
self.render(self.true_positives.len().to_string().bold(), options)
)?;
for symbol_occurrence in &self.true_positives {
let file = self
.evaluator
.display_path(symbol_occurrence.location.path_id);
let rng = symbol_occurrence.range();
let header = format!("{file}: L{} C{} -- ", rng.start_line, rng.start_col);
eprintln!(
"{} {}",
header.yellow(),
self.evaluator.display_symbol(symbol_occurrence.symbol)
);
self.write_occ("TP", symbol_occurrence, output)?;
}
}
if options.print_mapping {
write!(output, "\nSymbol mapping\n")?;
self.write_mapping(output, options)?;
}
Ok(())
}
}
#[derive(Default, Debug)]
pub struct Evaluator {
interner: StringInterner,
symbol_formatter: SymbolFormatter,
path_formatter: PathFormatter,
}
// Public API
@ -292,12 +417,10 @@ impl Evaluator {
&'e mut self,
candidate: PathBuf,
ground_truth: PathBuf,
options: ScipEvaluateOptions,
) -> Result<EvaluationResult<'e>> {
self.evaluate_indexes(
&read_index_from_file(candidate),
&read_index_from_file(ground_truth),
options,
)
}
@ -305,7 +428,6 @@ impl Evaluator {
&'e mut self,
candidate: &Index,
ground_truth: &Index,
options: ScipEvaluateOptions,
) -> Result<EvaluationResult<'e>> {
validate_index(candidate)?;
validate_index(ground_truth)?;
@ -451,43 +573,47 @@ impl Evaluator {
result
};
if options.print_mapping {
let mut candidate_mapping_vec: Vec<(
SymbolId<Candidate>,
HashMap<SymbolId<GroundTruth>, Overlap>,
)> = candidate_mapping.into_iter().collect();
// if options.print_mapping {
// let mut candidate_mapping_vec: Vec<(
// SymbolId<Candidate>,
// HashMap<SymbolId<GroundTruth>, Overlap>,
// )> = candidate_mapping.into_iter().collect();
candidate_mapping_vec.sort_by_key(|(sym, _)| *sym);
// candidate_mapping_vec.sort_by_key(|(sym, _)| *sym);
for (candidate_symbol, alternatives) in candidate_mapping_vec.into_iter() {
let candidate = self.try_strip_package_details(candidate_symbol);
let mut alternatives_vec: Vec<(SymbolId<GroundTruth>, Overlap)> =
alternatives.into_iter().collect();
alternatives_vec.sort_by_key(|(sym, _)| *sym);
// for (candidate_symbol, alternatives) in candidate_mapping_vec.into_iter() {
// let candidate = self
// .symbol_formatter
// .try_strip_package_details(candidate_symbol);
// let mut alternatives_vec: Vec<(SymbolId<GroundTruth>, Overlap)> =
// alternatives.into_iter().collect();
// alternatives_vec.sort_by_key(|(sym, _)| *sym);
eprintln!("{}", self.display_symbol(candidate).red());
// eprintln!("{}", self.symbol_formatter.display_symbol(candidate).red());
for (ground_truth_symbol, overlap) in &alternatives_vec {
let ground_truth = self.try_strip_package_details(*ground_truth_symbol);
let adjusted_weight = symbol_pair_weight
.get(&SymbolPair {
candidate: candidate_symbol,
ground_truth: *ground_truth_symbol,
})
.unwrap();
// for (ground_truth_symbol, overlap) in &alternatives_vec {
// let ground_truth = self
// .symbol_formatter
// .try_strip_package_details(*ground_truth_symbol);
// let adjusted_weight = symbol_pair_weight
// .get(&SymbolPair {
// candidate: candidate_symbol,
// ground_truth: *ground_truth_symbol,
// })
// .unwrap();
eprintln!(
" {:.2} {} [{}/{} occurrences]",
adjusted_weight,
self.display_symbol(ground_truth).green(),
overlap.common,
overlap.total
);
}
// eprintln!(
// " {:.2} {} [{}/{} occurrences]",
// adjusted_weight,
// self.symbol_formatter.display_symbol(ground_truth).green(),
// overlap.common,
// overlap.total
// );
// }
eprintln!();
}
}
// eprintln!();
// }
// }
let mut classified_locations: Vec<ClassifiedLocation> = Vec::new();
@ -527,7 +653,9 @@ impl Evaluator {
// This is an impossible situation by construction
None => panic!(
"Couldn't find a mapping for symbol {}",
self.display_symbol(ground_truth_symbol).red()
self.symbol_formatter
.display_symbol(ground_truth_symbol)
.red()
),
}
}
@ -555,12 +683,40 @@ impl Evaluator {
bar.finish_and_clear();
Ok(EvaluationResult::new(self, classified_locations, options))
Ok(EvaluationResult::new(
self,
classified_locations,
SymbolMapping {
candidate_sets: candidate_mapping,
symbol_pair_weight,
},
))
}
}
// Private API
impl Evaluator {
#[derive(Default, Debug)]
struct PathFormatter {
interner: StringInterner,
}
impl PathFormatter {
fn make_path_id(&mut self, s: &str) -> PathId {
PathId {
value: self.interner.get_or_intern(s),
}
}
fn display_path(&self, s: PathId) -> &str {
self.interner.resolve(s.value).unwrap()
}
}
#[derive(Default, Debug)]
struct SymbolFormatter {
interner: StringInterner,
}
impl SymbolFormatter {
fn make_symbol_id<T>(&mut self, s: &str) -> SymbolId<T> {
SymbolId {
value: self.interner.get_or_intern(s),
@ -568,20 +724,10 @@ impl Evaluator {
}
}
fn make_path_id(&mut self, s: &str) -> PathId {
PathId {
value: self.interner.get_or_intern(s),
}
}
fn display_symbol<T>(&self, s: SymbolId<T>) -> &str {
self.interner.resolve(s.value).unwrap()
}
fn display_path(&self, s: PathId) -> &str {
self.interner.resolve(s.value).unwrap()
}
fn try_strip_package_details<T: Copy>(&mut self, sym: SymbolId<T>) -> SymbolId<T> {
let s = self.display_symbol(sym);
if s.as_bytes().iter().filter(|&c| *c == b' ').count() != 5 {
@ -602,19 +748,19 @@ impl Evaluator {
let mut out: HashMap<LocationInFile, SymbolId<T>> = HashMap::new();
for doc in &index.documents {
let path_id = self.make_path_id(&doc.relative_path);
let path_id = self.path_formatter.make_path_id(&doc.relative_path);
out.reserve(doc.occurrences.len());
for occ in &doc.occurrences {
let rng = PackedRange::from_vec(&occ.range).unwrap();
let sym_id: SymbolId<T>;
if let Some(prefix) = occ.symbol.strip_prefix("local ") {
sym_id = self.make_symbol_id(&format!(
sym_id = self.symbol_formatter.make_symbol_id(&format!(
"local doc-{}-{}",
path_id.value.to_usize(),
prefix
));
} else {
sym_id = self.make_symbol_id(&occ.symbol);
sym_id = self.symbol_formatter.make_symbol_id(&occ.symbol);
}
let loc = LocationInFile { rng, path_id };
out.insert(loc, sym_id);
@ -670,7 +816,7 @@ mod tests {
// Evaluating index against itself should yield 100% precision and 100% recall
{
let evaluate_with_self = evaluator
.evaluate_indexes(&ground_truth, &ground_truth, Default::default())
.evaluate_indexes(&ground_truth, &ground_truth)
.unwrap();
assert_eq!(evaluate_with_self.summary.precision_percent, 100.0);
assert_eq!(evaluate_with_self.summary.recall_percent, 100.0);
@ -695,7 +841,6 @@ mod tests {
),
]),
&ground_truth,
Default::default(),
)
.unwrap();
assert_eq!(evaluate_disjoint.summary.precision_percent, 0.0);
@ -709,15 +854,13 @@ mod tests {
// Evaluating empty index is an error
{
let evaluate_empty =
evaluator.evaluate_indexes(&empty_index, &ground_truth, Default::default());
let evaluate_empty = evaluator.evaluate_indexes(&empty_index, &ground_truth);
assert!(evaluate_empty.is_err());
}
// Evaluating against an empty index is an error
{
let evaluate_against_empty =
evaluator.evaluate_indexes(&ground_truth, &empty_index, Default::default());
let evaluate_against_empty = evaluator.evaluate_indexes(&ground_truth, &empty_index);
assert!(evaluate_against_empty.is_err());
}
}

View File

@ -164,9 +164,10 @@ pub fn index_command(
let mut evaluator = Evaluator::default();
evaluator
.evaluate_indexes(&index, &ground_truth, Default::default())
.evaluate_indexes(&index, &ground_truth)
.unwrap()
.print_summary();
.write_summary(&mut std::io::stdout(), Default::default())
.unwrap();
}
write_message_to_file(out, index).expect("to write the file");

View File

@ -0,0 +1,7 @@
*.class
.gradle
.semanticdb
.bsp
.metals
.scala-build
semanticdb-targetroot

View File

@ -0,0 +1,14 @@
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
application {
// Define the main class for the application.
mainClass = 'com.sourcegraph.graph.twodwo.Main'
}

View File

@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -0,0 +1,245 @@
#!/bin/sh
# shellcheck disable=all
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
../../../../../../bazel-bin/docker-images/syntax-highlighter/crates/scip-treesitter-cli/index-java.scip

View File

@ -0,0 +1,22 @@
package com.sourcegraph.graph.twodwo;
public class Main {
public static void main(String[] args) {
var todoList = new TodoList();
for(String i: args) {
todoList.addTodo(new TodoList.Item(i));
}
todoList.addTodo(new TodoList.Item("balling", true));
todoList.addTodo(new TodoList.Item("winning"));
todoList.summarise();
}
}

View File

@ -0,0 +1,49 @@
package com.sourcegraph.graph.twodwo;
import java.util.ArrayList;
public class TodoList {
public static class Item {
private String title;
private boolean done;
public Item(String title) {
this.title = title;
this.done = false;
}
public Item(String title, boolean done) {
this.title = title;
this.done = done;
}
public String getTitle() {
return this.title;
}
}
private ArrayList<Item> todos;
public TodoList() {
todos = new ArrayList<>();
}
public void addTodo(Item todo) {
todos.add(todo);
}
public ArrayList<Item> getTodos() {
return todos;
}
public void summarise() {
System.out.println("TODO:");
for (Item item : todos) {
if (item.done)
System.out.println(" [x] " + item.getTitle());
else
System.out.println(" [_] " + item.getTitle());
}
}
}

View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -e
tarball="$1"
image_name="$2"
project_root="$(dirname "$3")"
scip_command="$4"
out="$5"
# We can't directly mount $project_root, because those are symbolic links created by the sandboxing mechansim. So instead, we copy everything over.
tmp_folder=$(mktemp -d)
cp -R -L "$project_root"/* $tmp_folder/
# Delete temp folder on exit
trap "rm -Rf $tmp_folder" EXIT
docker load --input="$tarball"
# The setup below only exists to work around our current
# docker setup on CI where it runs in a sidecar.
# This means we cannot mount folders, to both provide files to the indexer,
# and to get the SCIP file back. What we can do is connect stdin/stdout.
# Therefore, until that setup changes, we tar the sources and pipe it into the container,
# and then pipe the index back after indexing.
temp_scip_path="$tmp_folder/index-piped.scip"
tar_sources_command="tar -cv -C $tmp_folder ."
write_scip_file_command="base64 -d > $temp_scip_path"
command_inside_container="(tar -xv >&2 && $scip_command >&2) && (cat ./index.scip | base64)"
run_docker_command="docker run -i -a stdin -a stdout -a stderr $image_name bash -c '$command_inside_container'"
eval "$tar_sources_command | $run_docker_command | $write_scip_file_command"
if [ -s $temp_scip_path ]
then
# Copy the piped SCIP index to the destination expected by Bazel build
cp "$tmp_folder"/index-piped.scip "$out"
else
echo "SCIP file produced by the container is empty"
exit 1
fi

View File

@ -6,6 +6,8 @@ use std::{env::temp_dir, path::PathBuf};
use assert_cmd::cargo::cargo_bin;
use assert_cmd::prelude::*;
use scip_treesitter_cli::evaluate::Evaluator;
use scip_treesitter_cli::index::{index_command, AnalysisMode, IndexMode, IndexOptions};
use scip_treesitter_cli::io::read_index_from_file;
lazy_static::lazy_static! {
@ -15,6 +17,21 @@ lazy_static::lazy_static! {
_ => cargo_bin("scip-treesitter"),
}
};
static ref BASE: PathBuf = {
match std::env::var("CARGO_MANIFEST_DIR") {
Ok(va) => std::env::current_dir().unwrap().join(va),
_ => std::env::current_dir().unwrap() }
};
static ref JAVA_SCIP_INDEX: PathBuf = {
match std::env::var("JAVA_SCIP_INDEX") {
Ok(va) => std::env::current_dir().unwrap().join(va),
_ => BASE.join("testdata/java/index.scip")
}
};
}
use syntax_analysis::snapshot::{dump_document_with_config, EmitSymbol, SnapshotOptions};
@ -31,6 +48,48 @@ fn snapshot_syntax_document(doc: &scip::types::Document, source: &str) -> String
.expect("dump document")
}
#[test]
fn java_e2e_evaluation() {
let dir = BASE.join("testdata/java");
let out_dir = temp_dir();
let candidate = out_dir.join("index-tree-sitter.scip");
index_command(
"java".to_string(),
IndexMode::Workspace {
location: dir.clone(),
},
candidate.clone(),
dir.clone(),
None,
IndexOptions {
analysis_mode: AnalysisMode::Full,
fail_fast: true,
},
);
let mut str = vec![];
Evaluator::default()
.evaluate_files(candidate, JAVA_SCIP_INDEX.to_path_buf())
.unwrap()
.write_summary(
&mut str,
scip_treesitter_cli::evaluate::EvaluationOutputOptions {
print_false_negatives: true,
print_true_positives: true,
print_false_positives: true,
print_mapping: true,
disable_colors: true,
},
)
.unwrap();
insta::assert_snapshot!("java_evaluation", String::from_utf8(str).unwrap());
}
#[test]
fn java_e2e_indexing() {
let out_dir = temp_dir();

View File

@ -0,0 +1,168 @@
---
source: crates/scip-treesitter-cli/tests/integration_test.rs
expression: "String::from_utf8(str).unwrap()"
---
{"precision_percent":"100.0","recall_percent":"37.4","true_positives":"34.0","false_positives":"0.0","false_negatives":"57.0"}
False negatives (FN): 57
[FN] src/main/java/Main.java: L0 C8 -- semanticdb maven . . com/
[FN] src/main/java/Main.java: L0 C12 -- semanticdb maven . . com/sourcegraph/
[FN] src/main/java/Main.java: L0 C24 -- semanticdb maven . . com/sourcegraph/graph/
[FN] src/main/java/Main.java: L0 C30 -- semanticdb maven . . com/sourcegraph/graph/twodwo/
[FN] src/main/java/Main.java: L5 C28 -- semanticdb maven jdk 17 java/lang/String#
[FN] src/main/java/Main.java: L7 C27 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#`<init>`().
[FN] src/main/java/Main.java: L9 C12 -- semanticdb maven jdk 17 java/lang/String#
[FN] src/main/java/Main.java: L10 C21 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#addTodo().
[FN] src/main/java/Main.java: L10 C33 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#
[FN] src/main/java/Main.java: L10 C42 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`().
[FN] src/main/java/Main.java: L13 C17 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#addTodo().
[FN] src/main/java/Main.java: L13 C29 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#
[FN] src/main/java/Main.java: L13 C38 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`(+1).
[FN] src/main/java/Main.java: L14 C17 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#addTodo().
[FN] src/main/java/Main.java: L14 C29 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#
[FN] src/main/java/Main.java: L14 C38 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`().
[FN] src/main/java/Main.java: L17 C17 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#summarise().
[FN] src/main/java/TodoList.java: L0 C8 -- semanticdb maven . . com/
[FN] src/main/java/TodoList.java: L0 C12 -- semanticdb maven . . com/sourcegraph/
[FN] src/main/java/TodoList.java: L0 C24 -- semanticdb maven . . com/sourcegraph/graph/
[FN] src/main/java/TodoList.java: L0 C30 -- semanticdb maven . . com/sourcegraph/graph/twodwo/
[FN] src/main/java/TodoList.java: L2 C7 -- semanticdb maven . . java/
[FN] src/main/java/TodoList.java: L2 C12 -- semanticdb maven . . java/util/
[FN] src/main/java/TodoList.java: L2 C17 -- semanticdb maven jdk 17 java/util/ArrayList#
[FN] src/main/java/TodoList.java: L7 C10 -- semanticdb maven jdk 17 java/lang/String#
[FN] src/main/java/TodoList.java: L10 C14 -- semanticdb maven jdk 17 java/lang/String#
[FN] src/main/java/TodoList.java: L11 C8 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#title.
[FN] src/main/java/TodoList.java: L12 C8 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#done.
[FN] src/main/java/TodoList.java: L15 C14 -- semanticdb maven jdk 17 java/lang/String#
[FN] src/main/java/TodoList.java: L16 C8 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#title.
[FN] src/main/java/TodoList.java: L17 C8 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#done.
[FN] src/main/java/TodoList.java: L20 C9 -- semanticdb maven jdk 17 java/lang/String#
[FN] src/main/java/TodoList.java: L21 C15 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#title.
[FN] src/main/java/TodoList.java: L25 C9 -- semanticdb maven jdk 17 java/util/ArrayList#
[FN] src/main/java/TodoList.java: L25 C19 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#
[FN] src/main/java/TodoList.java: L28 C2 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#todos.
[FN] src/main/java/TodoList.java: L28 C14 -- semanticdb maven jdk 17 java/util/ArrayList#`<init>`(+1).
[FN] src/main/java/TodoList.java: L31 C21 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#
[FN] src/main/java/TodoList.java: L32 C2 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#todos.
[FN] src/main/java/TodoList.java: L32 C8 -- semanticdb maven jdk 17 java/util/ArrayList#add(+1).
[FN] src/main/java/TodoList.java: L35 C8 -- semanticdb maven jdk 17 java/util/ArrayList#
[FN] src/main/java/TodoList.java: L35 C18 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#
[FN] src/main/java/TodoList.java: L36 C9 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#todos.
[FN] src/main/java/TodoList.java: L40 C4 -- semanticdb maven jdk 17 java/lang/System#
[FN] src/main/java/TodoList.java: L40 C11 -- semanticdb maven jdk 17 java/lang/System#out.
[FN] src/main/java/TodoList.java: L40 C15 -- semanticdb maven jdk 17 java/io/PrintStream#println(+8).
[FN] src/main/java/TodoList.java: L41 C7 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#
[FN] src/main/java/TodoList.java: L41 C19 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#todos.
[FN] src/main/java/TodoList.java: L42 C12 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#done.
[FN] src/main/java/TodoList.java: L43 C4 -- semanticdb maven jdk 17 java/lang/System#
[FN] src/main/java/TodoList.java: L43 C11 -- semanticdb maven jdk 17 java/lang/System#out.
[FN] src/main/java/TodoList.java: L43 C15 -- semanticdb maven jdk 17 java/io/PrintStream#println(+8).
[FN] src/main/java/TodoList.java: L43 C38 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#getTitle().
[FN] src/main/java/TodoList.java: L45 C4 -- semanticdb maven jdk 17 java/lang/System#
[FN] src/main/java/TodoList.java: L45 C11 -- semanticdb maven jdk 17 java/lang/System#out.
[FN] src/main/java/TodoList.java: L45 C15 -- semanticdb maven jdk 17 java/io/PrintStream#println(+8).
[FN] src/main/java/TodoList.java: L45 C38 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#getTitle().
True positives: 35
[TP] src/main/java/Main.java: L3 C13 -- semanticdb maven . . com/sourcegraph/graph/twodwo/Main#`<init>`().
[TP] src/main/java/Main.java: L5 C23 -- semanticdb maven . . com/sourcegraph/graph/twodwo/Main#main().
[TP] src/main/java/Main.java: L5 C37 -- local doc-0-0
[TP] src/main/java/Main.java: L7 C12 -- local doc-0-1
[TP] src/main/java/Main.java: L9 C19 -- local doc-0-2
[TP] src/main/java/Main.java: L9 C22 -- local doc-0-0
[TP] src/main/java/Main.java: L10 C12 -- local doc-0-1
[TP] src/main/java/Main.java: L10 C47 -- local doc-0-2
[TP] src/main/java/Main.java: L13 C8 -- local doc-0-1
[TP] src/main/java/Main.java: L14 C8 -- local doc-0-1
[TP] src/main/java/Main.java: L17 C8 -- local doc-0-1
[TP] src/main/java/TodoList.java: L4 C13 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#
[TP] src/main/java/TodoList.java: L6 C21 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#
[TP] src/main/java/TodoList.java: L7 C17 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#title.
[TP] src/main/java/TodoList.java: L8 C18 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#done.
[TP] src/main/java/TodoList.java: L10 C9 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`().
[TP] src/main/java/TodoList.java: L10 C21 -- local doc-1-0
[TP] src/main/java/TodoList.java: L11 C16 -- local doc-1-0
[TP] src/main/java/TodoList.java: L15 C9 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`(+1).
[TP] src/main/java/TodoList.java: L15 C21 -- local doc-1-1
[TP] src/main/java/TodoList.java: L15 C36 -- local doc-1-2
[TP] src/main/java/TodoList.java: L16 C16 -- local doc-1-1
[TP] src/main/java/TodoList.java: L17 C15 -- local doc-1-2
[TP] src/main/java/TodoList.java: L20 C16 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#getTitle().
[TP] src/main/java/TodoList.java: L25 C25 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#todos.
[TP] src/main/java/TodoList.java: L27 C8 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#`<init>`().
[TP] src/main/java/TodoList.java: L31 C13 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#addTodo().
[TP] src/main/java/TodoList.java: L31 C26 -- local doc-1-3
[TP] src/main/java/TodoList.java: L32 C12 -- local doc-1-3
[TP] src/main/java/TodoList.java: L35 C24 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#getTodos().
[TP] src/main/java/TodoList.java: L39 C13 -- semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#summarise().
[TP] src/main/java/TodoList.java: L41 C12 -- local doc-1-4
[TP] src/main/java/TodoList.java: L42 C7 -- local doc-1-4
[TP] src/main/java/TodoList.java: L43 C33 -- local doc-1-4
[TP] src/main/java/TodoList.java: L45 C33 -- local doc-1-4
Symbol mapping
scip-ctags . . . Main#
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/Main#`<init>`(). [1/1 occurrences]
scip-ctags . . . Main#main().
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/Main#main(). [1/1 occurrences]
local doc-0-1
1.00 local doc-0-0 [2/2 occurrences]
local doc-0-2
1.00 local doc-0-1 [5/5 occurrences]
local doc-0-3
1.00 local doc-0-2 [2/2 occurrences]
scip-ctags . . . TodoList#
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList# [1/4 occurrences]
scip-ctags . . . TodoList#summarise().
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#summarise(). [1/2 occurrences]
scip-ctags . . . TodoList#getTodos().
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#getTodos(). [1/1 occurrences]
scip-ctags . . . TodoList#addTodo().
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#addTodo(). [1/4 occurrences]
scip-ctags . . . TodoList#TodoList().
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#`<init>`(). [1/2 occurrences]
scip-ctags . . . TodoList#todos.
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#todos. [1/5 occurrences]
scip-ctags . . . TodoList#Item#
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item# [1/5 occurrences]
scip-ctags . . . TodoList#Item#getTitle().
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#getTitle(). [1/3 occurrences]
scip-ctags . . . TodoList#Item#Item().
0.40 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`(). [1/3 occurrences]
0.60 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#`<init>`(+1). [1/2 occurrences]
scip-ctags . . . TodoList#Item#done.
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#done. [1/4 occurrences]
scip-ctags . . . TodoList#Item#title.
1.00 semanticdb maven . . com/sourcegraph/graph/twodwo/TodoList#Item#title. [1/4 occurrences]
local doc-1-1
1.00 local doc-1-0 [2/2 occurrences]
local doc-1-2
1.00 local doc-1-1 [2/2 occurrences]
local doc-1-3
1.00 local doc-1-2 [2/2 occurrences]
local doc-1-4
1.00 local doc-1-3 [2/2 occurrences]
local doc-1-5
1.00 local doc-1-4 [4/4 occurrences]