Skip to content

Commit

Permalink
feature: count all language versions
Browse files Browse the repository at this point in the history
  • Loading branch information
abanoubha committed Apr 27, 2024
1 parent 38b3644 commit 7de9e76
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"net/http"
"os"
"strings"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -138,42 +139,45 @@ func getFormulasFromFile(fileName, langName string) (map[interface{}]struct{}, e
allFormulas := map[interface{}]struct{}{}

for _, formula := range formulas {

langAt := langName + "@"

// BuildDependencies
if len(formula.BuildDependencies) > 0 {
for _, dep := range formula.BuildDependencies {
if dep == langName {
if dep == langName || strings.HasPrefix(dep, langAt) {
allFormulas[formula.Name] = struct{}{}
}
}
}
// Dependencies
if len(formula.Dependencies) > 0 {
for _, dep := range formula.Dependencies {
if dep == langName {
if dep == langName || strings.HasPrefix(dep, langAt) {
allFormulas[formula.Name] = struct{}{}
}
}
}
// TestDependencies
if len(formula.TestDependencies) > 0 {
for _, dep := range formula.TestDependencies {
if dep == langName {
if dep == langName || strings.HasPrefix(dep, langAt) {
allFormulas[formula.Name] = struct{}{}
}
}
}
// RecommendedDependencies
if len(formula.RecommendedDependencies) > 0 {
for _, dep := range formula.RecommendedDependencies {
if dep == langName {
if dep == langName || strings.HasPrefix(dep, langAt) {
allFormulas[formula.Name] = struct{}{}
}
}
}
// OptionalDependencies
if len(formula.OptionalDependencies) > 0 {
for _, dep := range formula.OptionalDependencies {
if dep == langName {
if dep == langName || strings.HasPrefix(dep, langAt) {
allFormulas[formula.Name] = struct{}{}
}
}
Expand Down

0 comments on commit 7de9e76

Please sign in to comment.