PRP: Add Scala SBT build file extractor#1981
Open
Amsamms wants to merge 2 commits intogoogle:mainfrom
Open
Conversation
Adds a filesystem extractor for Scala SBT build files (.sbt) that extracts Maven package dependencies. Supports: - Single dependency declarations (libraryDependencies +=) - Seq block declarations (libraryDependencies ++= Seq(...)) - Version variable resolution (val/lazy val) - All SBT cross-version operators (%, %%, %%%) - Configurable file size limits with 10MB default Closes google#1022
Switch from regexp.Compile to regexp.MustCompile for constant pattern strings, satisfying the gocritic regexpMust lint rule. These patterns are string literals known at compile time, so MustCompile is the correct choice.
Author
|
Friendly ping @erikvarga @cuixq — this Scala SBT build file extractor PR has been open for 10 days with all 13 CI checks passing. Per the PRP inventory scope (post-Apr 9), this extractor parses |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a filesystem extractor for Scala SBT build files (
.sbt) that extracts Maven package dependencies.Closes #1022
Supported SBT dependency patterns
libraryDependencies += "groupId" %% "artifactId" % "version"libraryDependencies ++= Seq("g" %% "a" % "v", ...)val ver = "1.0.0"/lazy val ver = "1.0.0"references%,%%,%%%% Testsuffix (ignored for extraction)Design decisions
Based on review feedback from #1801:
PluginConfig.MaxFileSizeBytes. File size checked inFileRequired()before reading.New(): All regex patterns are compiled during initialization and stored in theExtractorstruct, avoiding repeated compilation inExtract()and theMustCompilevsCompilelint conflict.FileRequiredandExtractboth report stats viastats.Collector.javalockfile.Metadata: SBT resolves to Maven artifacts, so we reuse the Java lockfile metadata type (no proto changes needed).linelint.Files changed
extractor/filesystem/language/scala/sbt/sbt.go— Extractor implementationextractor/filesystem/language/scala/sbt/sbt_test.go— Tests forFileRequiredandExtractextractor/filesystem/language/scala/sbt/testdata/— Test fixturesextractor/filesystem/list/list.go— RegistersScalaSourceextractordocs/supported_inventory_types.md— Documents the new extractorTesting
All tests pass locally on Go 1.24.2: