Monorepo for Tangled tangled.org
859
fork

Configure Feed

Select the types of activity you want to include in your feed.

knotserver/git: skip unknown files in language breakdown #325

open opened by tolik518.tngl.sh targeting master from tolik518.tngl.sh/core: master

The "Other" language is currently including all "Unknown" files. This is distorting the language percentages for repos containing lots of assets (games mostly).

Other git websites like Github or Gitlab don't do that. I tested the repo mentioned in #523 and pushed it (privately) to Github, which showed me 100% GDScript. Based on that behavior I've adjusted the current language selection.

Fixes #523

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:wzoaxleof2leut3d5uk73qry/sh.tangled.repo.pull/3ml2kpuc3yb22
+13 -2
Diff #0
+12 -1
appview/repo/index.go
··· 162 162 orm.FilterEq("ref", currentRef), 163 163 ) 164 164 165 - if err != nil || langs == nil { 165 + if err != nil || langs == nil || containsOtherLanguage(langs) { 166 + langs = nil 167 + 166 168 // non-fatal, fetch langs from ks via XRPC 167 169 xrpcc := &indigoxrpc.Client{ 168 170 Host: rp.config.KnotMirror.Url, ··· 238 240 return languageStats, nil 239 241 } 240 242 243 + func containsOtherLanguage(langs []models.RepoLanguage) bool { 244 + for _, l := range langs { 245 + if l.Language == enry.OtherLanguage { 246 + return true 247 + } 248 + } 249 + return false 250 + } 251 + 241 252 // buildIndexResponse creates a RepoIndexResponse by combining multiple xrpc calls in parallel 242 253 func (rp *Repo) buildIndexResponse(ctx context.Context, repo *models.Repo, ref string) (*types.RepoIndexResponse, error) { 243 254 xrpcc := &indigoxrpc.Client{Host: rp.config.KnotMirror.Url}
+1 -1
knotserver/git/language.go
··· 33 33 } 34 34 35 35 langType := enry.GetLanguageType(language) 36 - if langType != enry.Programming && langType != enry.Markup && langType != enry.Unknown { 36 + if langType != enry.Programming && langType != enry.Markup { 37 37 return nil 38 38 } 39 39

History

2 rounds 0 comments
sign up or login to add to the discussion
2 commits
expand
knotserver/git: skip unknown files in language breakdown
knotserver/git: regression test language percentage skips unknown files
merge conflicts detected
expand
  • appview/repo/index.go:162
  • knotserver/git/language.go:33
expand 0 comments
tolik518.tngl.sh submitted #0
1 commit
expand
knotserver/git: skip unknown files in language breakdown
expand 0 comments