Detailed changes
@@ -136,7 +136,7 @@ func (f *DiffFile) Files() (from *DiffFileChange, to *DiffFileChange) {
return
}
-// FileStats.
+// FileStats represents statistics for changed files in a diff.
type FileStats []*DiffFile
// String returns a string representation of file stats.
@@ -237,7 +237,7 @@ type Diff struct {
Files []*DiffFile
}
-// FileStats returns the diff file stats.
+// Stats returns the diff file stats.
func (d *Diff) Stats() FileStats {
return d.Files
}
@@ -8,7 +8,7 @@ import (
)
var (
- // DiffMaxFile is the maximum number of files to show in a diff.
+ // DiffMaxFiles is the maximum number of files to show in a diff.
DiffMaxFiles = 1000
// DiffMaxFileLines is the maximum number of lines to show in a file diff.
DiffMaxFileLines = 1000
@@ -1,3 +1,4 @@
+// Package access defines access control levels and permissions for repositories and users.
package access
import (
@@ -37,7 +37,7 @@ func NewScheduler(ctx context.Context) *Scheduler {
}
}
-// Shutdonw gracefully shuts down the Scheduler.
+// Shutdown gracefully shuts down the Scheduler.
func (s *Scheduler) Shutdown() {
ctx, cancel := context.WithTimeout(s.Cron.Stop(), 30*time.Second)
defer func() { cancel() }()
@@ -58,7 +58,7 @@ type GitDaemon struct {
liMu sync.Mutex
}
-// NewDaemon returns a new Git daemon.
+// NewGitDaemon returns a new Git daemon.
func NewGitDaemon(ctx context.Context) (*GitDaemon, error) {
cfg := config.FromContext(ctx)
addr := cfg.Git.ListenAddr
@@ -6,7 +6,6 @@ import (
"log"
"net"
"os"
- "strings"
"testing"
"time"
@@ -86,7 +85,7 @@ func TestIdleTimeout(t *testing.T) {
time.Sleep(10 * time.Millisecond)
}
time.Sleep(2 * time.Second)
- _, err = readPktline(c)
+ err = readPktline(c)
if err == nil {
t.Errorf("expected error, got nil")
}
@@ -100,16 +99,16 @@ func TestInvalidRepo(t *testing.T) {
if err := pktline.NewEncoder(c).EncodeString("git-upload-pack /test.git\x00"); err != nil {
t.Fatalf("expected nil, got error: %v", err)
}
- _, err = readPktline(c)
+ err = readPktline(c)
if err != nil && err.Error() != git.ErrInvalidRepo.Error() {
t.Errorf("expected %q error, got %q", git.ErrInvalidRepo, err)
}
}
-func readPktline(c net.Conn) (string, error) {
+func readPktline(c net.Conn) error {
pktout := pktline.NewScanner(c)
if !pktout.Scan() {
- return "", pktout.Err()
+ return pktout.Err()
}
- return strings.TrimSpace(string(pktout.Bytes())), nil
+ return nil
}
@@ -1,3 +1,4 @@
+// Package db provides database interface and connection management for Soft Serve.
package db
import "context"
@@ -1,3 +1,4 @@
+// Package log provides logging functionality and context-aware logging utilities.
package log
import (
@@ -1,3 +1,4 @@
+// Package proto defines protocol buffer-like interfaces and data structures for the Soft Serve API.
package proto
import "time"
@@ -28,7 +28,7 @@ func TestSession(t *testing.T) {
is := is.New(t)
t.Run("authorized repo access", func(t *testing.T) {
t.Log("setting up")
- s, close := setup(t)
+ s, cleanup := setup(t)
s.Stderr = os.Stderr
t.Log("requesting pty")
err := s.RequestPty("xterm", 80, 40, nil)
@@ -43,7 +43,7 @@ func TestSession(t *testing.T) {
var ee *gossh.ExitMissingError
is.True(errors.As(err, &ee))
t.Log("session exited")
- is.NoErr(close())
+ is.NoErr(cleanup())
})
}
@@ -162,7 +162,7 @@ func initializePermissions(ctx ssh.Context) {
}
}
-// PublicKeyAuthHandler handles public key authentication.
+// PublicKeyHandler handles public key authentication.
func (s *SSHServer) PublicKeyHandler(ctx ssh.Context, pk ssh.PublicKey) (allowed bool) {
if pk == nil {
return false
@@ -13,7 +13,7 @@ type Component interface {
SetSize(width, height int)
}
-// TabComponenet represents a model that is mounted to a tab.
+// TabComponent represents a model that is mounted to a tab.
// TODO: find a better name.
type TabComponent interface {
Component
@@ -1,3 +1,4 @@
+// Package keymap defines key bindings and keyboard shortcuts for the TUI.
package keymap
import "github.com/charmbracelet/bubbles/v2/key"
@@ -52,7 +52,7 @@ type Item struct {
cmd string
}
-// New creates a new Item.
+// NewItem creates a new Item.
func NewItem(c common.Common, repo proto.Repository) (Item, error) {
var lastUpdate *time.Time
lu := repo.UpdatedAt()
@@ -351,11 +351,11 @@ func check(ts *testscript.TestScript, err error, neg bool) {
}
}
-func cmdReadfile(ts *testscript.TestScript, neg bool, args []string) {
+func cmdReadfile(ts *testscript.TestScript, neg bool, args []string) { //nolint:unparam
ts.Stdout().Write([]byte(ts.ReadFile(args[0])))
}
-func cmdEnvfile(ts *testscript.TestScript, neg bool, args []string) {
+func cmdEnvfile(ts *testscript.TestScript, neg bool, args []string) { //nolint:unparam
if len(args) < 1 {
ts.Fatalf("usage: envfile key=file...")
}
@@ -481,7 +481,7 @@ func cmdCurl(ts *testscript.TestScript, neg bool, args []string) {
check(ts, cmd.Execute(), neg)
}
-func cmdEnsureServerRunning(ts *testscript.TestScript, neg bool, args []string) {
+func cmdEnsureServerRunning(ts *testscript.TestScript, neg bool, args []string) { //nolint:unparam
if len(args) < 1 {
ts.Fatalf("Must supply a TCP port of one of the services to connect to. " +
"These are set as env vars as they are randomized. " +
@@ -507,7 +507,7 @@ func cmdEnsureServerRunning(ts *testscript.TestScript, neg bool, args []string)
}
}
-func cmdEnsureServerNotRunning(ts *testscript.TestScript, neg bool, args []string) {
+func cmdEnsureServerNotRunning(ts *testscript.TestScript, neg bool, args []string) { //nolint:unparam
if len(args) < 1 {
ts.Fatalf("Must supply a TCP port of one of the services to connect to. " +
"These are set as env vars as they are randomized. " +
@@ -533,7 +533,7 @@ func cmdEnsureServerNotRunning(ts *testscript.TestScript, neg bool, args []strin
}
}
-func cmdStopserver(ts *testscript.TestScript, neg bool, args []string) {
+func cmdStopserver(ts *testscript.TestScript, neg bool, args []string) { //nolint:unparam
// stop the server
resp, err := http.DefaultClient.Head(fmt.Sprintf("%s/__stop", ts.Getenv("SOFT_SERVE_HTTP_PUBLIC_URL")))
check(ts, err, neg)