Skip to content

Commit

Permalink
Add initial workspace finder
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-debricked committed Aug 22, 2024
1 parent 04e5703 commit e0751d5
Show file tree
Hide file tree
Showing 8 changed files with 781 additions and 4 deletions.
7 changes: 7 additions & 0 deletions internal/file/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func isCompressed(filename string) bool {
return compressed
}

func (finder *Finder) getWorkspaces(options DebrickedOptions) ([]string, error) {
var workspaces []string

return workspaces, nil
}

func (finder *Finder) GetIncludedGroups(formats []*CompiledFormat, options DebrickedOptions) (Groups, error) {
// NOTE: inefficient because it walks into excluded directories
var groups Groups
Expand Down Expand Up @@ -194,6 +200,7 @@ func (finder *Finder) GetGroups(options DebrickedOptions) (Groups, error) {
return groups, err
}
}
// Find workspace and add root lock to groups

groups.FilterGroupsByStrictness(options.Strictness)

Expand Down
8 changes: 4 additions & 4 deletions internal/file/finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestGetGroups(t *testing.T) {
path := ""

excludedFiles := []string{"testdata/go/go.mod", "testdata/misc/requirements.txt", "testdata/misc/Cargo.lock"}
const nbrOfGroups = 6
const nbrOfGroups = 10

fileGroups, err := finder.GetGroups(
DebrickedOptions{
Expand Down Expand Up @@ -349,15 +349,15 @@ func TestGetGroupsWithStrictFlag(t *testing.T) {
name: "StrictnessSetTo0",
strictness: StrictAll,
testedGroupIndex: 3,
expectedNumberOfGroups: 11,
expectedNumberOfGroups: 14,
expectedManifestFile: "composer.json",
expectedLockFiles: []string{"composer.lock", "go.mod", "Cargo.lock", "requirements.txt.pip.debricked"},
},
{
name: "StrictnessSetTo1",
strictness: StrictLockAndPairs,
testedGroupIndex: 1,
expectedNumberOfGroups: 6,
expectedNumberOfGroups: 7,
expectedManifestFile: "",
expectedLockFiles: []string{
"composer.lock", "composer.lock", "go.mod", "Cargo.lock", "requirements.txt.pip.debricked", "requirements-dev.txt.pip.debricked",
Expand All @@ -367,7 +367,7 @@ func TestGetGroupsWithStrictFlag(t *testing.T) {
name: "StrictnessSetTo2",
strictness: StrictPairs,
testedGroupIndex: 0,
expectedNumberOfGroups: 4,
expectedNumberOfGroups: 5,
expectedManifestFile: "composer.json",
expectedLockFiles: []string{
"composer.lock", "requirements-dev.txt.pip.debricked.lock", "requirements.txt.pip.debricked.lock",
Expand Down
Loading

0 comments on commit e0751d5

Please sign in to comment.