Skip to content

Commit

Permalink
change to xp instead of experience
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwareus committed Nov 4, 2023
1 parent f8ea615 commit 771e0c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/experience/experience.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func NewExperienceCmd(experienceCalculator experience.IExperience) *cobra.Comman

short := "Experience calculator uses git blame and call graphs to calculate who has written code with what open source. [beta feature]"
cmd := &cobra.Command{
Use: "experience [path]",
Use: "xp [path]",
Short: short,
Hidden: false,
Long: short, //TODO: Add long description

Check failure on line 20 in internal/cmd/experience/experience.go

View workflow job for this annotation

GitHub Actions / Lint

internal/cmd/experience/experience.go:20: Line contains TODO/BUG/FIXME: "TODO: Add long description" (godox)
Expand Down
10 changes: 6 additions & 4 deletions internal/experience/experience.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/debricked/cli/internal/file"
"github.com/debricked/cli/internal/git"
"github.com/debricked/cli/internal/tui"
)

var OutputFileNameExperience = "debricked.experience.json"
Expand All @@ -16,17 +17,18 @@ type IExperience interface {
}

type ExperienceCalculator struct {
finder file.IFinder
finder file.IFinder
spinnerManager tui.ISpinnerManager
}

func NewExperience(finder file.IFinder) *ExperienceCalculator {
return &ExperienceCalculator{
finder: finder,
finder: finder,
spinnerManager: tui.NewSpinnerManager("Calculating OSS-Experience", "0"),
}
}

func (e *ExperienceCalculator) CalculateExperience(rootPath string, exclusions []string) (*Experiences, error) {
log.Println("Calculating experience...")

repo, repoErr := git.FindRepository(rootPath)
if repoErr != nil {
Expand All @@ -40,7 +42,7 @@ func (e *ExperienceCalculator) CalculateExperience(rootPath string, exclusions [
return nil, err
}

log.Println("Blamed files:", len(blames))
log.Println("Blamed files: ", len(blames))
return nil, nil

Check failure on line 46 in internal/experience/experience.go

View workflow job for this annotation

GitHub Actions / Lint

return both the `nil` error and invalid value: use a sentinel error instead (nilnil)
}

Expand Down
10 changes: 4 additions & 6 deletions internal/file/exclusion.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,16 @@ func Excluded(exclusions []string, path string) bool {

func InclusionsExperience() []string {
return []string{
"**/*.go",
".go",
".java",
}
}

func Included(inclusions []string, path string) bool {
for _, exclusion := range inclusions {
ex := filepath.Clean(exclusion)
matched, _ := doublestar.PathMatch(ex, path)
if matched {
for _, ex := range inclusions {
if strings.HasSuffix(path, ex) {
return true
}
}

return false

Check failure on line 77 in internal/file/exclusion.go

View workflow job for this annotation

GitHub Actions / Lint

return with no blank line before (nlreturn)
}

0 comments on commit 771e0c3

Please sign in to comment.