1,118 matches across 25 files for func main
snippet_mode: grep · sorted by relevance
README.md MARKDOWN 24 matches · showing 5 view file →
176- [gocloc](https://github.com/hhatto/gocloc) a sloc counter in Go inspired by tokei
177- [loc](https://github.com/cgag/loc) rust implementation similar to tokei but often faster
178- [loccount](https://gitlab.com/esr/loccount) Go implementation written and maintained by ESR
179- [polyglot](https://github.com/vmchale/polyglot) ATS sloc counter
180- [tokei](https://github.com/XAMPPRocky/tokei) fast, accurate and written in rust
· · ·
181- [sloc](https://github.com/flosse/sloc) coffeescript code counter
182- [stto](https://github.com/mainak55512/stto) new Go code counter with a focus on performance
183
184Interesting reading about other code counting projects tokei, loc, polyglot and loccount
· · ·
274 Count a specific folder or file:
275 scc myproject/
276 scc main.go
277
278 Count several paths at once:
· · ·
365 --no-config disable auto-discovery of the SCC_CONFIG_PATH global and the project ./.sccconfig config
366 -d, --no-duplicates remove duplicate files from stats and output
367 --no-fold-authors disable the name+email-domain identity folding fallback for git author reports (mailmap still applied)
368 --no-gen ignore generated files in output (implies --gen)
369 --no-gitignore disables .gitignore file logic
· · ·
601Because some languages don't have loops and instead use recursion they can have a lower complexity count. Does this mean they are less complex? Probably not, but the tool cannot see this because it does not build an AST of the code as it only scans through it.
602
603Generally though the complexity there is to help estimate between projects written in the same language, or for finding the most complex file in a project `scc --by-file -s complexity` which can be useful when you are estimating on how hard something is to maintain, or when looking for those files that should probably be refactored.
604
605As for how it works.
+ 19 more matches in this file
benchmark_to_chart.py PYTHON 5 matches view file →
13
14
15def main():
16 if len(sys.argv) < 2:
17 print(f"Usage: {sys.argv[0]} benchmark_regression.json [title]")
· · ·
40 google.charts.setOnLoadCallback(drawChart);
41
42 function drawChart() {{
43 var data = google.visualization.arrayToDataTable([
44 ['Version', 'Runtime (seconds)'],
· · ·
48 var options = {{
49 title: '{title}',
50 curveType: 'function',
51 legend: {{ position: 'bottom' }}
52 }};
· · ·
66
67
68if __name__ == "__main__":
69 main()
70
· · ·
69 main()
70
cmd/badges/main.go GO 25 matches · showing 5 view file →
1package main
2
3import (
· · ·
38)
39
40func intPtr(i int) *int {
41 return &i
42}
· · ·
43
44func timePtr(t time.Duration) *time.Duration {
45 return &t
46}
· · ·
47
48func main() {
49 http.HandleFunc("/health-check/", func(w http.ResponseWriter, r *http.Request) {
50 locationLogMutex.Lock()
· · ·
49 http.HandleFunc("/health-check/", func(w http.ResponseWriter, r *http.Request) {
50 locationLogMutex.Lock()
51 for k, v := range locationTracker {
+ 20 more matches in this file
cmd/badges/main_test.go GO 9 matches · showing 5 view file →
1package main
2
3import (
· · ·
7)
8
9func Test_resolveColor(t *testing.T) {
10 tests := []struct {
11 name string
· · ·
55
56 for _, tt := range tests {
57 t.Run(tt.name, func(t *testing.T) {
58 if got := resolveColor(tt.color); got != tt.want {
59 t.Errorf("resolveColor(%q) = %q, want %q", tt.color, got, tt.want)
· · ·
63}
64
65func Test_formatCount(t *testing.T) {
66 type args struct {
67 count float64
· · ·
123 }
124 for _, tt := range tests {
125 t.Run(tt.name, func(t *testing.T) {
126 if got := formatCount(tt.args.count); got != tt.want {
127 t.Errorf("formatCount() = %v, want %v", got, tt.want)
+ 4 more matches in this file
config.go GO 35 matches · showing 5 view file →
1// SPDX-License-Identifier: MIT
2
3package main
4
5import (
· · ·
22// the user-facing `completion` command. These must reach cobra with the genuine
23// argv, so config discovery is skipped for them.
24func isCompletionInvocation(args []string) bool {
25 if len(args) < 2 {
26 return false
· · ·
69// config file from injecting count targets. When true (@file) positional lines
70// are kept, preserving the existing @file behaviour.
71func parseConfigArgs(content string, allowPositional bool) []string {
72 var args []string
73
· · ·
116// quote-aware tokens, stripping an unquoted trailing '#' comment. Backslash is
117// a literal outside quotes.
118func tokenizeConfigLine(line string) []string {
119 var tokens []string
120 var sb strings.Builder
· · ·
122 inToken := false
123
124 flush := func() {
125 if inToken {
126 tokens = append(tokens, sb.String())
+ 30 more matches in this file
config_test.go GO 49 matches · showing 5 view file →
1// SPDX-License-Identifier: MIT
2
3package main
4
5import (
· · ·
22// runSCCDir runs the test binary as scc in the given working directory, with
23// optional extra environment entries (KEY=VALUE).
24func runSCCDir(t *testing.T, dir string, env []string, args ...string) (string, error) {
25 t.Helper()
26 bin, err := filepath.Abs(sccBinPath)
· · ·
38}
39
40func TestParseConfigArgs(t *testing.T) {
41 t.Parallel()
42 tests := []struct {
· · ·
129
130 for _, tc := range tests {
131 t.Run(tc.name, func(t *testing.T) {
132 got := parseConfigArgs(tc.content, tc.allowPositional)
133 if !slices.Equal(got, tc.want) {
· · ·
138}
139
140func TestPreScanConfig(t *testing.T) {
141 t.Parallel()
142 tests := []struct {
+ 44 more matches in this file
main.go GO 7 matches · showing 5 view file →
1// SPDX-License-Identifier: MIT
2
3package main
4
5import (
· · ·
15)
16
17func printShellCompletion(cmd *cobra.Command, command string) error {
18 switch command {
19 case "bash":
· · ·
30}
31
32func printFlagSuggestion(flagSet *pflag.FlagSet, unknownFlag string) {
33 flags := processor.GetMostSimilarFlags(flagSet, unknownFlag)
34 if len(flags) == 0 {
· · ·
48
49//go:generate go run scripts/include.go
50func main() {
51 // f, _ := os.Create("scc.pprof")
52 // pprof.StartCPUProfile(f)
· · ·
56 // the bare boolean form and the explicit --mcp=true form pflag accepts, so the
57 // server starts consistently however the flag is spelled.
58 if slices.ContainsFunc(os.Args[1:], func(a string) bool {
59 return a == "--mcp" || a == "--mcp=true"
60 }) {
+ 2 more matches in this file
main_test.go GO 49 matches · showing 5 view file →
1package main
2
3import (
· · ·
14)
15
16const sccTestFlag string = "-test.main"
17
18var sccBinPath = os.Args[0]
· · ·
19
20func TestMain(m *testing.M) {
21 idx := slices.Index(os.Args, sccTestFlag)
22 if idx != -1 {
· · ·
23 os.Args = slices.Delete(os.Args, idx, idx+1)
24 main()
25 return
26 }
· · ·
29}
30
31func runSCC(args ...string) (string, error) {
32 args = slices.Insert(args, 0, sccTestFlag)
33 cmd := exec.Command(sccBinPath, args...)
+ 44 more matches in this file
mcp.go GO 16 matches · showing 5 view file →
1// SPDX-License-Identifier: MIT
2
3package main
4
5import (
· · ·
24var mcpMu sync.Mutex
25
26func startMCPServer() {
27 mcpServer := server.NewMCPServer(
28 "scc",
· · ·
218}
219
220func mcpAnalyzeHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
221 args := request.GetArguments()
222
· · ·
430}
431
432func mcpHotspotsHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
433 args := request.GetArguments()
434
· · ·
487}
488
489func mcpCouplingHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
490 args := request.GetArguments()
491
+ 11 more matches in this file
mcp_test.go GO 15 matches · showing 5 view file →
1// SPDX-License-Identifier: MIT
2
3package main
4
5import (
· · ·
25// the floor and never surface — giving both the all-pairs and per-file views a
26// single, predictable coupling to assert on. Returns the repo path.
27func makeCouplingRepo(t *testing.T) string {
28 t.Helper()
29 dir := t.TempDir()
· · ·
74const nestedCognitiveSource = `package sample
75
76func deeplyNested(items []int) int {
77 total := 0
78 for _, v := range items {
· · ·
91// callAnalyze runs the MCP analyze handler against dir with the supplied args
92// and returns the decoded response.
93func callAnalyze(t *testing.T, dir string, args map[string]any) mcpAnalyzeResponse {
94 t.Helper()
95
· · ·
129}
130
131func writeNestedFixture(t *testing.T) string {
132 t.Helper()
133 dir := t.TempDir()
+ 10 more matches in this file
packages/chocolatey/tools/chocolateyinstall.ps1 POWERSHELL 2 matches view file →
75#Install-ChocolateyInstallPackage @packageArgs # https://chocolatey.org/docs/helpers-install-chocolatey-install-package
76
77## Main helper functions - these have error handling tucked into them already
78## see https://chocolatey.org/docs/helpers-reference
79
· · ·
93## see the full list at https://chocolatey.org/docs/helpers-reference
94
95## downloader that the main helpers use to download items
96## if removing $url64, please remove from here
97## - https://chocolatey.org/docs/helpers-get-chocolatey-web-file
packages/chocolatey/tools/chocolateyuninstall.ps1 POWERSHELL 2 matches view file →
65 Write-Warning "$($key.Count) matches found!"
66 Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
67 Write-Warning "Please alert package maintainer the following keys were matched:"
68 $key | % {Write-Warning "- $($_.DisplayName)"}
69}
· · ·
70
71## OTHER POWERSHELL FUNCTIONS
72## https://chocolatey.org/docs/helpers-reference
73#Uninstall-ChocolateyZipPackage $packageName # Only necessary if you did not unpack to package directory - see https://chocolatey.org/docs/helpers-uninstall-chocolatey-zip-package
processor/cognitive_nesting_test.go GO 12 matches · showing 5 view file →
20// if nesting 3 -> +4
21// if nesting 4 -> +5 total 14
22const deepChain = "func main() {\n" +
23 " if a {\n" +
24 " if b {\n" +
· · ·
37// if nesting 1 -> +2
38// if nesting 2 -> +3 total 10
39const deNested = "func main() {\n" +
40 " if a {\n" +
41 " if b {\n" +
· · ·
51//
52// if if if if each nesting 1 -> +2 each total 8
53const flat = "func main() {\n" +
54 " if a {\n }\n" +
55 " if b {\n }\n" +
· · ·
61// three shapes, strictly decreasing cognitive as they flatten — while the flat
62// cyclomatic Complexity stays 4 throughout.
63func TestCognitiveDeepVsDeNestedVsFlat(t *testing.T) {
64 Cognitive = true
65 defer func() { Cognitive = false }()
· · ·
65 defer func() { Cognitive = false }()
66
67 deep := countCognitive(t, "Go", deepChain)
+ 7 more matches in this file
processor/file_test.go GO 31 matches · showing 5 view file →
11)
12
13func TestGetExtension(t *testing.T) {
14 got := getExtension("something.c")
15 expected := "c"
· · ·
20}
21
22func TestGetExtensionNoExtension(t *testing.T) {
23 got := getExtension("something")
24 expected := "something"
· · ·
29}
30
31func TestGetExtensionMultipleDots(t *testing.T) {
32 got := getExtension(".travis.yml")
33 expected := "travis.yml"
· · ·
38}
39
40func TestGetExtensionMultipleExtensions(t *testing.T) {
41 got := getExtension("something.go.yml")
42 expected := "go.yml"
· · ·
47}
48
49func TestGetExtensionStartsWith(t *testing.T) {
50 got := getExtension(".gitignore")
51 expected := ".gitignore"
+ 26 more matches in this file
processor/history.go GO 32 matches · showing 5 view file →
20
21// HistoryDepth is the maximum number of commits the history engine walks. 0
22// means "entire history". Wired to --depth in main.go.
23var HistoryDepth = 1000
24
· · ·
142// pass user input unchecked. A degenerate window (from == to or to before
143// from) yields Width=0; all commits land in bucket 0 / N-1.
144func NewBucketing(from, to time.Time, n int) Bucketing {
145 if n <= 0 {
146 n = 1
· · ·
156// clamp to 0 (defensive — should not happen given the walk window). Times at
157// or after To clamp to N-1.
158func (b Bucketing) Index(t time.Time) int {
159 if b.N <= 0 {
160 return 0
· · ·
181// Start returns the wall-clock start time of bucket i. Indexes outside
182// [0, N) are clamped.
183func (b Bucketing) Start(i int) time.Time {
184 if b.N <= 0 {
185 return b.From
· · ·
195
196// emptySnapshot is what observers see when HEAD is missing or empty.
197func emptySnapshot() HeadSnapshot {
198 return HeadSnapshot{Files: map[string]HeadFile{}}
199}
+ 27 more matches in this file
processor/history_author_timeline_test.go GO 39 matches · showing 5 view file →
29// snapshots. Used to seed historyAuthorTimelineObserver with known author /
30// timestamp distributions.
31func makeTimelineRepo(t *testing.T, commits []timelineCommit) string {
32 t.Helper()
33 ProcessConstants()
· · ·
70}
71
72func findTimelineRow(t *testing.T, rows []authorTimelineRow, name string) authorTimelineRow {
73 t.Helper()
74 for _, r := range rows {
· · ·
81}
82
83func TestBucketingIndex(t *testing.T) {
84 from := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
85 to := time.Date(2025, 1, 11, 0, 0, 0, 0, time.UTC) // 10-day span
· · ·
113}
114
115func TestBucketingDegenerateWindow(t *testing.T) {
116 when := time.Date(2025, 1, 1, 12, 0, 0, 0, time.UTC)
117 b := NewBucketing(when, when, 8)
· · ·
124}
125
126func TestBucketingStart(t *testing.T) {
127 from := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
128 to := from.Add(10 * 24 * time.Hour)
+ 34 more matches in this file
processor/history_authors.go GO 27 matches · showing 5 view file →
18
19// authorsTopN is the cap on tabular rows for the author rollup. CSV/JSON
20// output is not capped. The remainder collapses into a single "others (N)"
21// row in the tabular table.
22const authorsTopN = 15
· · ·
77}
78
79func newHistoryAuthorsObserver() *historyAuthorsObserver {
80 return &historyAuthorsObserver{
81 blame: map[string][]authorID{},
· · ·
90// baseline snapshot — every pre-window line maps to sentinelAuthorID so
91// surviving untouched lines are correctly attributed to "(before window)".
92func (o *historyAuthorsObserver) Seed(baseline BaselineSnapshot) {
93 o.registry = newAuthorRegistry(baseline.Mailmap)
94 for path, bf := range baseline.Files {
· · ·
103}
104
105func (o *historyAuthorsObserver) Observe(c CommitInfo, changes []FileChange) {
106 aid := o.registry.intern(c.Author, c.Email)
107 if prev, ok := o.lastSeen[aid]; !ok || c.When.After(prev) {
· · ·
131}
132
133func (o *historyAuthorsObserver) Finalise(window HistoryWindow, head HeadSnapshot) {
134 o.window = window
135 o.snapshot = head
+ 22 more matches in this file
processor/history_authors_test.go GO 60 matches · showing 5 view file →
28// using the caller's named author. Used to exercise per-author attribution
29// in the authors observer.
30func makeAuthoredRepo(t *testing.T, commits []authoredCommit) string {
31 t.Helper()
32 ProcessConstants()
· · ·
72// findAuthorRow returns the row whose canonical name matches `name`, or
73// fails the test.
74func findAuthorRow(t *testing.T, rows []authorRow, name string) authorRow {
75 t.Helper()
76 for _, r := range rows {
· · ·
83}
84
85func TestAuthorsLastToucherAttribution(t *testing.T) {
86 saveDepth := HistoryDepth
87 HistoryDepth = 100
· · ·
88 t.Cleanup(func() { HistoryDepth = saveDepth })
89
90 // Alice introduces 7 lines; Bob rewrites lines 4–7 (4 lines).
· · ·
91 // Net: Alice owns 3, Bob owns 4. No (before window) — full history walked.
92 first := "package x\nfunc A() {}\nfunc B() {}\nfunc C() {}\nfunc D() {}\nfunc E() {}\nfunc F() {}\n"
93 // 7 lines: line1=package, line2=A, line3=B, line4=C, line5=D, line6=E, line7=F.
94 // We want Bob to rewrite lines 4-7 (4 lines).
+ 55 more matches in this file
processor/history_blame.go GO 21 matches · showing 5 view file →
30// name+email so two commit identities mapped to the same canonical pair
31// collapse to one authorID. When fold is true, a second index folds
32// distinct emails that share the same (lowercase name, email domain) — a
33// best-effort fallback for repos without a .mailmap.
34type authorRegistry struct {
· · ·
35 nameToID map[string]authorID
36 byNameDomain map[string]authorID
37 records []authorRecord
38 mm *mailmap
· · ·
40}
41
42func newAuthorRegistry(mm *mailmap) *authorRegistry {
43 return newAuthorRegistryWithFold(mm, FoldAuthors)
44}
· · ·
45
46func newAuthorRegistryWithFold(mm *mailmap, fold bool) *authorRegistry {
47 return &authorRegistry{
48 nameToID: map[string]authorID{},
· · ·
49 byNameDomain: map[string]authorID{},
50 records: []authorRecord{{}}, // slot 0 = sentinelAuthorID
51 mm: mm,
+ 16 more matches in this file
processor/history_blame_test.go GO 34 matches · showing 5 view file →
8)
9
10func TestApplyDiffToBlameNewFile(t *testing.T) {
11 got := applyDiffToBlame(nil, 3, []LineRange{{Start: 1, Count: 3}}, nil, 7)
12 want := []authorID{7, 7, 7}
· · ·
16}
17
18func TestApplyDiffToBlameAppend(t *testing.T) {
19 prev := []authorID{1, 1}
20 got := applyDiffToBlame(prev, 4, []LineRange{{Start: 3, Count: 2}}, nil, 9)
· · ·
25}
26
27func TestApplyDiffToBlamePureDelete(t *testing.T) {
28 prev := []authorID{1, 1, 1, 1}
29 got := applyDiffToBlame(prev, 2, nil, []LineRange{{Start: 2, Count: 2}}, 9)
· · ·
34}
35
36func TestApplyDiffToBlameReplaceMiddle(t *testing.T) {
37 // 5 lines from author 1; replace line 3 with two lines from author 2.
38 prev := []authorID{1, 1, 1, 1, 1}
· · ·
47}
48
49func TestApplyDiffToBlamePadsToNewLines(t *testing.T) {
50 // Diff arithmetic disagrees with newLines — defensive pad with sentinel.
51 got := applyDiffToBlame(nil, 4, nil, nil, 9)
+ 29 more matches in this file
processor/history_coupling.go GO 35 matches · showing 5 view file →
69// 100%; multiplied by high test-file complexity that buries the real work.
70// Volume keeps the heavyweight couplings on top and matches --hotspots.
71func (c CouplingCount) WeightedScore() float64 {
72 return float64(c.Shared) * float64(min(c.ComplexityA, c.ComplexityB))
73}
· · ·
76// co-change first, then degree, then path. Shared by the raw sort and used as
77// the tiebreak under weighted ranking.
78func lessCouplingRaw(a, b CouplingCount) bool {
79 if a.Shared != b.Shared {
80 return a.Shared > b.Shared
· · ·
92// when the Cognitive global is on (matching --hotspots), cyclomatic otherwise.
93// A path absent from HEAD contributes zero, so it can never lift a pair's score.
94func headComplexity(head HeadSnapshot, path string) int64 {
95 hf, ok := head.Files[path]
96 if !ok {
· · ·
107// for the human-facing table only; the raw counts sit beside it so the number
108// is never a black box. Returns 0 when the union is empty.
109func (c CouplingCount) Degree() float64 {
110 union := c.CommitsA + c.CommitsB - c.Shared
111 if union <= 0 {
· · ·
141type pairKey struct{ a, b string }
142
143func newCouplingObserver() *couplingObserver {
144 return &couplingObserver{
145 maxFilesPerCommit: CouplingMaxFilesPerCommit,
+ 30 more matches in this file
processor/history_coupling_test.go GO 26 matches · showing 5 view file →
11
12// hasCandidate reports whether want is among the candidate forms.
13func hasCandidate(got []string, want string) bool {
14 for _, g := range got {
15 if g == want {
· · ·
23// the bare git path. This was the original --coupling-for bug: the prefix was
24// passed through and never matched, after a full history walk.
25func TestCouplingTargetCandidatesStripsDotSlash(t *testing.T) {
26 got := couplingTargetCandidates("/repo", "./processor/constants.go")
27 if !hasCandidate(got, "processor/constants.go") {
· · ·
30}
31
32func TestCouplingTargetCandidatesBarePathUnchanged(t *testing.T) {
33 got := couplingTargetCandidates("/repo", "processor/constants.go")
34 if !hasCandidate(got, "processor/constants.go") {
· · ·
37}
38
39func TestCouplingTargetCandidatesAbsoluteBecomesRepoRelative(t *testing.T) {
40 got := couplingTargetCandidates("/repo", filepath.FromSlash("/repo/processor/constants.go"))
41 if !hasCandidate(got, "processor/constants.go") {
· · ·
46// A path outside the repository can never be a git path, so it must yield no
47// candidates rather than a "../" form that would be looked up and miss.
48func TestCouplingTargetCandidatesRejectsEscapingPaths(t *testing.T) {
49 if got := couplingTargetCandidates("/repo", filepath.FromSlash("/etc/passwd")); len(got) != 0 {
50 t.Errorf("expected no candidates for a path outside the repo, got %v", got)
+ 21 more matches in this file
processor/history_ignore.go GO 8 matches · showing 5 view file →
24}
25
26func (h *historyIgnore) Match(p string, isDir bool) bool {
27 if h == nil || h.matcher == nil {
28 return false
· · ·
35// parses them, and produces a matcher. Respects the existing --no-ignore
36// (Ignore) and --no-scc-ignore (SccIgnore) flag globals.
37func buildHistoryIgnore(repo *git.Repository, head plumbing.Hash) (*historyIgnore, error) {
38 commit, err := repo.CommitObject(head)
39 if err != nil {
· · ·
46
47 var patterns []gitignore.Pattern
48 err = tree.Files().ForEach(func(f *object.File) error {
49 if f.Mode == filemode.Dir || f.Mode == filemode.Submodule || f.Mode == filemode.Symlink {
50 return nil
· · ·
65 defer reader.Close()
66
67 domain := splitDomain(path.Dir(f.Name))
68 patterns = append(patterns, parseIgnoreFile(reader, domain)...)
69 return nil
· · ·
68 patterns = append(patterns, parseIgnoreFile(reader, domain)...)
69 return nil
70 })
+ 3 more matches in this file
processor/history_ignore_test.go GO 6 matches · showing 5 view file →
10)
11
12func TestParseIgnoreFileSkipsCommentsAndBlanks(t *testing.T) {
13 body := strings.NewReader("# comment\n\nfoo\n!bar\n \n")
14 pats := parseIgnoreFile(body, nil)
· · ·
18}
19
20func TestHistoryIgnoreMatchesPattern(t *testing.T) {
21 pat := gitignore.ParsePattern("vendor/", nil)
22 h := &historyIgnore{matcher: gitignore.NewMatcher([]gitignore.Pattern{pat})}
· · ·
30}
31
32func TestHistoryIgnoreNilSafe(t *testing.T) {
33 var h *historyIgnore
34 if h.Match("anything", false) {
· · ·
37}
38
39func TestSplitDomain(t *testing.T) {
40 cases := []struct {
41 in string
· · ·
48 }
49 for _, c := range cases {
50 got := splitDomain(c.in)
51 if len(got) != c.want {
52 t.Errorf("splitDomain(%q) = %v, want length %d", c.in, got, c.want)
+ 1 more matches in this file
processor/history_languages_test.go GO 31 matches · showing 5 view file →
12)
13
14func findLanguagesRow(t *testing.T, rows []languagesTimelineRow, language string) languagesTimelineRow {
15 t.Helper()
16 for _, r := range rows {
· · ·
26// TypeScript code is added over time while JavaScript code is steadily
27// removed, the trajectory and change sign should reflect that.
28func TestLanguagesTimelineTSRisesJSFalls(t *testing.T) {
29 // Set HistoryDepth so the JS-baseline commit (commit 0) sits OUTSIDE
30 // the window — the engine then seeds JavaScript with that file's lines
· · ·
33 saveDepth, saveBuckets := HistoryDepth, HistoryBuckets
34 HistoryDepth, HistoryBuckets = 9, 10
35 t.Cleanup(func() {
36 HistoryDepth, HistoryBuckets = saveDepth, saveBuckets
37 })
· · ·
105// of the window and is then wholly removed should show codeNow == 0 and a
106// negative change.
107func TestLanguagesTimelineLanguageRemoval(t *testing.T) {
108 // depth=2 → only the last 2 commits are in the window. The first
109 // commit (which establishes the JS file) sits OUTSIDE the window and
· · ·
112 saveDepth, saveBuckets := HistoryDepth, HistoryBuckets
113 HistoryDepth, HistoryBuckets = 2, 6
114 t.Cleanup(func() {
115 HistoryDepth, HistoryBuckets = saveDepth, saveBuckets
116 })
+ 26 more matches in this file
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.