diff --git a/utils/coreutils/techutils.go b/utils/coreutils/techutils.go index fa12fc2b2..5a24ef707 100644 --- a/utils/coreutils/techutils.go +++ b/utils/coreutils/techutils.go @@ -48,8 +48,6 @@ type TechData struct { exclude []string // Whether this technology is supported by the 'jf ci-setup' command. ciSetupSupport bool - // Whether Contextual Analysis supported in this technology. - applicabilityScannable bool // The files that handle the project's dependencies. packageDescriptors []string // Formal name of the technology @@ -64,17 +62,15 @@ type TechData struct { var technologiesData = map[Technology]TechData{ Maven: { - indicators: []string{"pom.xml"}, - ciSetupSupport: true, - packageDescriptors: []string{"pom.xml"}, - execCommand: "mvn", - applicabilityScannable: true, + indicators: []string{"pom.xml"}, + ciSetupSupport: true, + packageDescriptors: []string{"pom.xml"}, + execCommand: "mvn", }, Gradle: { - indicators: []string{"build.gradle", "build.gradle.kts"}, - ciSetupSupport: true, - packageDescriptors: []string{"build.gradle", "build.gradle.kts"}, - applicabilityScannable: true, + indicators: []string{"build.gradle", "build.gradle.kts"}, + ciSetupSupport: true, + packageDescriptors: []string{"build.gradle", "build.gradle.kts"}, }, Npm: { indicators: []string{"package.json", "package-lock.json", "npm-shrinkwrap.json"}, @@ -84,7 +80,6 @@ var technologiesData = map[Technology]TechData{ formal: string(Npm), packageVersionOperator: "@", packageInstallationCommand: "install", - applicabilityScannable: true, }, Pnpm: { indicators: []string{"pnpm-lock.yaml"}, @@ -92,14 +87,12 @@ var technologiesData = map[Technology]TechData{ packageDescriptors: []string{"package.json"}, packageVersionOperator: "@", packageInstallationCommand: "update", - applicabilityScannable: true, }, Yarn: { indicators: []string{".yarnrc.yml", "yarn.lock", ".yarn", ".yarnrc"}, exclude: []string{"pnpm-lock.yaml"}, packageDescriptors: []string{"package.json"}, packageVersionOperator: "@", - applicabilityScannable: true, }, Go: { indicators: []string{"go.mod"}, @@ -108,11 +101,10 @@ var technologiesData = map[Technology]TechData{ packageInstallationCommand: "get", }, Pip: { - packageType: Pypi, - indicators: []string{"setup.py", "requirements.txt"}, - packageDescriptors: []string{"setup.py", "requirements.txt"}, - exclude: []string{"Pipfile", "Pipfile.lock", "pyproject.toml", "poetry.lock"}, - applicabilityScannable: true, + packageType: Pypi, + indicators: []string{"setup.py", "requirements.txt"}, + packageDescriptors: []string{"setup.py", "requirements.txt"}, + exclude: []string{"Pipfile", "Pipfile.lock", "pyproject.toml", "poetry.lock"}, }, Pipenv: { packageType: Pypi, @@ -120,7 +112,6 @@ var technologiesData = map[Technology]TechData{ packageDescriptors: []string{"Pipfile"}, packageVersionOperator: "==", packageInstallationCommand: "install", - applicabilityScannable: true, }, Poetry: { packageType: Pypi, @@ -128,7 +119,6 @@ var technologiesData = map[Technology]TechData{ packageDescriptors: []string{"pyproject.toml"}, packageInstallationCommand: "add", packageVersionOperator: "==", - applicabilityScannable: true, }, Nuget: { indicators: []string{".sln", ".csproj"}, @@ -188,10 +178,6 @@ func (tech Technology) GetPackageInstallationCommand() string { return technologiesData[tech].packageInstallationCommand } -func (tech Technology) ApplicabilityScannable() bool { - return technologiesData[tech].applicabilityScannable -} - func DetectedTechnologiesList() (technologies []string) { wd, err := os.Getwd() if errorutils.CheckError(err) != nil { @@ -478,12 +464,3 @@ func GetAllTechnologiesList() (technologies []Technology) { } return } - -func ContainsApplicabilityScannableTech(technologies []Technology) bool { - for _, technology := range technologies { - if technology.ApplicabilityScannable() { - return true - } - } - return false -} diff --git a/utils/coreutils/techutils_test.go b/utils/coreutils/techutils_test.go index c69d58ebe..c8b2e5c5e 100644 --- a/utils/coreutils/techutils_test.go +++ b/utils/coreutils/techutils_test.go @@ -490,20 +490,3 @@ func TestGetTechInformationFromWorkingDir(t *testing.T) { }) } } - -func TestContainsApplicabilityScannableTech(t *testing.T) { - tests := []struct { - name string - technologies []Technology - want bool - }{ - {name: "contains supported and unsupported techs", technologies: []Technology{Nuget, Go, Npm}, want: true}, - {name: "contains supported techs only", technologies: []Technology{Maven, Yarn, Npm}, want: true}, - {name: "contains unsupported techs only", technologies: []Technology{Dotnet, Nuget, Go}, want: false}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.want, ContainsApplicabilityScannableTech(tt.technologies)) - }) - } -}