Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
catalog:
- internal/config/data/packages.yaml
- changed-files:
- any-glob-to-any-file:
- internal/config/data/packages.yaml

brew:
- internal/brew/**
- changed-files:
- any-glob-to-any-file:
- internal/brew/**

installer:
- internal/installer/**
- changed-files:
- any-glob-to-any-file:
- internal/installer/**

ci:
- .github/workflows/**
- changed-files:
- any-glob-to-any-file:
- .github/workflows/**

docs:
- "*.md"
- docs/**
- changed-files:
- any-glob-to-any-file:
- "*.md"
- docs/**

tests:
- "**/*_test.go"
- changed-files:
- any-glob-to-any-file:
- "**/*_test.go"

snapshot:
- internal/snapshot/**
- changed-files:
- any-glob-to-any-file:
- internal/snapshot/**

ui:
- internal/ui/**
- changed-files:
- any-glob-to-any-file:
- internal/ui/**
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
go-version-file: "go.mod"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
version: v2.11.4

Expand Down
11 changes: 3 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ version: "2"

run:
timeout: 5m
exclude-dirs:
- vendor
- testutil

formatters:
enable:
Expand Down Expand Up @@ -46,13 +43,11 @@ linters:
excludes:
- G304 # File path provided as taint input — acceptable for CLI tools
exclusions:
paths:
- vendor
- testutil
rules:
- path: "_test\\.go"
linters:
- errcheck
- gosec
- path: "testutil/"
linters:
- gosec
- errcheck
- unused
4 changes: 3 additions & 1 deletion internal/brew/brew.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ func CheckDiskSpace() (float64, error) {
if err := syscall.Statfs(home, &stat); err != nil {
return 0, err
}
availableGB := float64(stat.Bavail*uint64(stat.Bsize)) / (1024 * 1024 * 1024)
// stat.Bsize is uint32 on darwin and int64 on linux; the kernel always
// reports a non-negative block size so the conversion is safe.
availableGB := float64(stat.Bavail*uint64(stat.Bsize)) / (1024 * 1024 * 1024) //nolint:gosec // see comment above
return availableGB, nil
}

Expand Down
13 changes: 13 additions & 0 deletions internal/dotfiles/dotfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,19 @@ func resolveBranch(dotfilesPath string) string {
branch = strings.TrimPrefix(ref, "refs/remotes/origin/")
}
}
// origin/HEAD may not be configured locally — ask the remote what its default branch is.
if branch == "" || branch == "HEAD" {
if out, err := gitOutputFunc([]string{"-C", dotfilesPath, "ls-remote", "--symref", "origin", "HEAD"}); err == nil {
for _, line := range strings.Split(string(out), "\n") {
if rest, ok := strings.CutPrefix(line, "ref: "); ok {
if fields := strings.Fields(rest); len(fields) >= 1 {
branch = strings.TrimPrefix(fields[0], "refs/heads/")
break
}
}
}
}
}
if branch == "" || branch == "HEAD" {
return "main"
}
Expand Down
2 changes: 1 addition & 1 deletion internal/snapshot/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func CaptureNpm() ([]string, error) {
if len(lines) <= 1 {
return []string{}, nil
}
var packages []string
packages := []string{}
for _, line := range lines[1:] {
line = strings.TrimSpace(line)
if line == "" {
Expand Down
Loading