Monorepo for Tangled tangled.org
856
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
+57
Interdiff #0 #1
appview/repo/index.go

This file has not been changed.

knotserver/git/language.go

This file has not been changed.

+57
knotserver/git/language_test.go
··· 1 + package git 2 + 3 + import ( 4 + "context" 5 + "strings" 6 + "testing" 7 + 8 + "github.com/stretchr/testify/require" 9 + "github.com/stretchr/testify/suite" 10 + ) 11 + 12 + type LanguageSuite struct { 13 + suite.Suite 14 + *RepoSuite 15 + } 16 + 17 + func TestLanguageSuite(t *testing.T) { 18 + t.Parallel() 19 + suite.Run(t, new(LanguageSuite)) 20 + } 21 + 22 + func (s *LanguageSuite) SetupTest() { 23 + s.RepoSuite = NewRepoSuite(s.T()) 24 + } 25 + 26 + func (s *LanguageSuite) TearDownTest() { 27 + s.RepoSuite.cleanup() 28 + } 29 + 30 + func (s *LanguageSuite) TestAnalyzeLanguagesSkipsUnknownGodotMetadata() { 31 + s.init() 32 + 33 + gdscript := "extends CharacterBody3D\n\nfunc _ready():\n\tpass\n" 34 + s.commitFile("code/player.gd", gdscript, "Add GDScript") 35 + s.commitFile("code/player.gd.uid", "uid://b5gy7avoc3cs1\n", "Add Godot uid") 36 + s.commitFile( 37 + "assets/player.glb.import", 38 + "[remap]\n\nimporter=\"scene\"\n\n[params]\n"+strings.Repeat("animation/import=true\n", 512), 39 + "Add Godot import metadata", 40 + ) 41 + s.commitFile( 42 + "scenes/player.tscn", 43 + "[gd_scene format=4]\n\n[sub_resource type=\"ArrayMesh\"]\n"+strings.Repeat("vertex_data = PackedByteArray(\"AAAA\")\n", 512), 44 + "Add Godot scene", 45 + ) 46 + 47 + gr, err := Open(s.repo.path, "") 48 + require.NoError(s.T(), err) 49 + 50 + langs, err := gr.AnalyzeLanguages(context.Background()) 51 + require.NoError(s.T(), err) 52 + 53 + require.NotContains(s.T(), langs, "") 54 + require.Equal(s.T(), LangBreakdown{ 55 + "GDScript": int64(len(gdscript)), 56 + }, langs) 57 + }

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
1 commit
expand
knotserver/git: skip unknown files in language breakdown
expand 0 comments