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
6 changes: 3 additions & 3 deletions .github/workflows/dataflow-pr-discussion-dataset.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/deep-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .github/workflows/issue-monster.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .github/workflows/smoke-claude.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/linters/deferinloop/deferinloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/github/gh-aw/pkg/logger"
)

var log = logger.New("linters:deferinloop")
var pkgLog = logger.New("linters:deferinloop")

// Analyzer is the defer-in-loop analysis pass.
var Analyzer = &analysis.Analyzer{
Expand All @@ -30,7 +30,7 @@ var Analyzer = &analysis.Analyzer{
}

func run(pass *analysis.Pass) (any, error) {
log.Printf("analyzing package %s", pass.Pkg.Path())
pkgLog.Printf("analyzing package %s", pass.Pkg.Path())

insp, err := astutil.Inspector(pass)
if err != nil {
Expand All @@ -56,7 +56,7 @@ func run(pass *analysis.Pass) (any, error) {
continue
}

log.Printf("flagging defer inside loop at %s", pos)
pkgLog.Printf("flagging defer inside loop at %s", pos)
pass.ReportRangef(deferStmt,
"defer inside a loop does not execute at the end of each iteration; it runs when the enclosing function returns, which can cause resource leaks")
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/linters/excessivefuncparams/excessivefuncparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/github/gh-aw/pkg/logger"
)

var log = logger.New("linters:excessivefuncparams")
var pkgLog = logger.New("linters:excessivefuncparams")

// DefaultMaxParams is the default maximum number of parameters allowed in a function declaration.
const DefaultMaxParams = 8
Expand All @@ -37,7 +37,7 @@ func init() {
}

func run(pass *analysis.Pass) (any, error) {
log.Printf("analyzing package %s (max-params=%d)", pass.Pkg.Path(), maxParams)
pkgLog.Printf("analyzing package %s (max-params=%d)", pass.Pkg.Path(), maxParams)

insp, err := astutil.Inspector(pass)
if err != nil {
Expand Down Expand Up @@ -75,7 +75,7 @@ func run(pass *analysis.Pass) (any, error) {
if nolint.HasDirective(position, noLintLinesByFile) {
return
}
log.Printf("flagging %s: %d parameters exceeds limit %d", fn.Name.Name, params, maxParams)
pkgLog.Printf("flagging %s: %d parameters exceeds limit %d", fn.Name.Name, params, maxParams)
pass.ReportRangef(
fn.Name,
"%s has %d parameters (limit: %d); consider using an options struct",
Expand Down
6 changes: 3 additions & 3 deletions pkg/linters/httprespbodyclose/httprespbodyclose.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/github/gh-aw/pkg/logger"
)

var log = logger.New("linters:httprespbodyclose")
var pkgLog = logger.New("linters:httprespbodyclose")

// Analyzer is the http-resp-body-close analysis pass.
var Analyzer = &analysis.Analyzer{
Expand All @@ -28,7 +28,7 @@ var Analyzer = &analysis.Analyzer{
}

func run(pass *analysis.Pass) (any, error) {
log.Printf("analyzing package %s", pass.Pkg.Path())
pkgLog.Printf("analyzing package %s", pass.Pkg.Path())

insp, err := astutil.Inspector(pass)
if err != nil {
Expand Down Expand Up @@ -177,7 +177,7 @@ type respVarState struct {
}

func reportMissingDefer(pass *analysis.Pass, state *respVarState) {
log.Printf("flagging non-deferred Body.Close() at %s", pass.Fset.PositionFor(state.assignPos, false))
pkgLog.Printf("flagging non-deferred Body.Close() at %s", pass.Fset.PositionFor(state.assignPos, false))

diag := analysis.Diagnostic{
Pos: state.assignPos,
Expand Down
6 changes: 3 additions & 3 deletions pkg/linters/httpstatuscode/httpstatuscode.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/github/gh-aw/pkg/logger"
)

var log = logger.New("linters:httpstatuscode")
var pkgLog = logger.New("linters:httpstatuscode")

var Analyzer = &analysis.Analyzer{
Name: "httpstatuscode",
Expand Down Expand Up @@ -94,7 +94,7 @@ var httpStatusNames = map[int]string{
}

func run(pass *analysis.Pass) (any, error) {
log.Printf("analyzing package %s", pass.Pkg.Path())
pkgLog.Printf("analyzing package %s", pass.Pkg.Path())

root, err := astutil.Root(pass)
if err != nil {
Expand Down Expand Up @@ -154,7 +154,7 @@ func checkAndReport(pass *analysis.Pass, lit *ast.BasicLit, noLintLinesByFile ma
return
}

log.Printf("flagging magic HTTP status code %d at %s", code, pos)
pkgLog.Printf("flagging magic HTTP status code %d at %s", code, pos)

if name, ok := httpStatusNames[code]; ok {
pass.Reportf(lit.Pos(), "use %s instead of magic HTTP status code %d", name, code)
Expand Down
6 changes: 3 additions & 3 deletions pkg/linters/largefunc/largefunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/github/gh-aw/pkg/logger"
)

var log = logger.New("linters:largefunc")
var pkgLog = logger.New("linters:largefunc")

// DefaultMaxLines is the default maximum number of lines allowed in a function body.
const DefaultMaxLines = 60
Expand All @@ -37,7 +37,7 @@ func init() {
}

func run(pass *analysis.Pass) (any, error) {
log.Printf("analyzing package %s (max-lines=%d)", pass.Pkg.Path(), maxLines)
pkgLog.Printf("analyzing package %s (max-lines=%d)", pass.Pkg.Path(), maxLines)

insp, err := astutil.Inspector(pass)
if err != nil {
Expand Down Expand Up @@ -84,7 +84,7 @@ func run(pass *analysis.Pass) (any, error) {
if nolint.HasDirective(position, noLintLinesByFile) {
return
}
log.Printf("flagging %s: %d lines exceeds limit %d", name, lines, maxLines)
pkgLog.Printf("flagging %s: %d lines exceeds limit %d", name, lines, maxLines)
pass.ReportRangef(
reportNode,
"%s is %d lines long (limit: %d); consider breaking it up",
Expand Down
18 changes: 9 additions & 9 deletions pkg/modelsdev/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var catalogURL = "https://models.dev/catalog.json"
// differing only in ".", "_", or "-" compare equal.
var modelIDReplacer = strings.NewReplacer(".", "-", "_", "-")

var log = logger.New("modelsdev:catalog")
var pkgLog = logger.New("modelsdev:catalog")

// rawCatalog mirrors the top-level models.dev catalog JSON structure.
type rawCatalog struct {
Expand Down Expand Up @@ -71,19 +71,19 @@ func FindPricing(ctx context.Context, provider, model string) (map[string]float6
normalizedModel := strings.ToLower(trimmedModel)
comparableModel := NormalizeComparableModelID(normalizedModel)

log.Printf("FindPricing: looking up provider=%q model=%q", normalizedProvider, normalizedModel)
pkgLog.Printf("FindPricing: looking up provider=%q model=%q", normalizedProvider, normalizedModel)

// Provider-scoped exact match.
if normalizedProvider != "" {
if providerModels, ok := catalog[normalizedProvider]; ok {
if pricing, ok := providerModels[normalizedModel]; ok {
log.Printf("FindPricing: provider-scoped exact match for %q/%q", normalizedProvider, normalizedModel)
pkgLog.Printf("FindPricing: provider-scoped exact match for %q/%q", normalizedProvider, normalizedModel)
return pricing, true
}
// Comparable (dot/underscore-normalized) model ID match.
for mn, pricing := range providerModels {
if NormalizeComparableModelID(mn) == comparableModel {
log.Printf("FindPricing: provider-scoped comparable match %q for %q", mn, normalizedModel)
pkgLog.Printf("FindPricing: provider-scoped comparable match %q for %q", mn, normalizedModel)
return pricing, true
}
}
Expand All @@ -93,18 +93,18 @@ func FindPricing(ctx context.Context, provider, model string) (map[string]float6
// Cross-provider fallback (when provider is unknown or empty).
for _, providerModels := range catalog {
if pricing, ok := providerModels[normalizedModel]; ok {
log.Printf("FindPricing: cross-provider fallback match for model %q", normalizedModel)
pkgLog.Printf("FindPricing: cross-provider fallback match for model %q", normalizedModel)
return pricing, true
}
for mn, pricing := range providerModels {
if NormalizeComparableModelID(mn) == comparableModel {
log.Printf("FindPricing: cross-provider comparable match %q for %q", mn, normalizedModel)
pkgLog.Printf("FindPricing: cross-provider comparable match %q for %q", mn, normalizedModel)
return pricing, true
}
}
}

log.Printf("FindPricing: no pricing found for provider=%q model=%q", normalizedProvider, normalizedModel)
pkgLog.Printf("FindPricing: no pricing found for provider=%q model=%q", normalizedProvider, normalizedModel)
return nil, false
}

Expand All @@ -115,14 +115,14 @@ func ensureCatalog(ctx context.Context) pricingCache {
downloaded, _ := catalogCache.Get(func() (pricingCache, error) {
downloaded, err := downloadAndParseCatalog(ctx)
if err != nil {
log.Printf("models.dev catalog download failed (pricing fallback unavailable): %v", err)
pkgLog.Printf("models.dev catalog download failed (pricing fallback unavailable): %v", err)
return pricingCache{}, nil
} else {
total := 0
for _, models := range downloaded {
total += len(models)
}
log.Printf("Downloaded models.dev catalog: %d providers, %d total models", len(downloaded), total)
pkgLog.Printf("Downloaded models.dev catalog: %d providers, %d total models", len(downloaded), total)
}
return downloaded, nil
})
Expand Down