Skip to content

Commit

Permalink
Remove applicabilityScannable attribute for technology
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Mar 12, 2024
1 parent 52423cf commit 242e124
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 51 deletions.
45 changes: 11 additions & 34 deletions utils/coreutils/techutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"},
Expand All @@ -84,21 +80,18 @@ var technologiesData = map[Technology]TechData{
formal: string(Npm),
packageVersionOperator: "@",
packageInstallationCommand: "install",
applicabilityScannable: true,
},
Pnpm: {
indicators: []string{"pnpm-lock.yaml"},
exclude: []string{".yarnrc.yml", "yarn.lock", ".yarn"},
packageDescriptors: []string{"package.json"},
packageVersionOperator: "@",
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"},
Expand All @@ -107,27 +100,24 @@ 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,
indicators: []string{"Pipfile", "Pipfile.lock"},
packageDescriptors: []string{"Pipfile"},
packageVersionOperator: "==",
packageInstallationCommand: "install",
applicabilityScannable: true,
},
Poetry: {
packageType: Pypi,
indicators: []string{"pyproject.toml", "poetry.lock"},
packageDescriptors: []string{"pyproject.toml"},
packageInstallationCommand: "add",
packageVersionOperator: "==",
applicabilityScannable: true,
},
Nuget: {
indicators: []string{".sln", ".csproj"},
Expand Down Expand Up @@ -187,10 +177,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 {
Expand Down Expand Up @@ -477,12 +463,3 @@ func GetAllTechnologiesList() (technologies []Technology) {
}
return
}

func ContainsApplicabilityScannableTech(technologies []Technology) bool {
for _, technology := range technologies {
if technology.ApplicabilityScannable() {
return true
}
}
return false
}
17 changes: 0 additions & 17 deletions utils/coreutils/techutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
}
}

0 comments on commit 242e124

Please sign in to comment.