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
8 changes: 1 addition & 7 deletions .arclint
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,14 @@
"script-and-regex.script": "./tools/linters/gazelle.sh",
"script-and-regex.regex": "/^(?P<severity>[[:alpha:]]+)\n(?P<file>[^\n]+)\n(?P<message>[^\n]+)\n((?P<line>\\d),(?P<char>\\d)\n<<<<<\n(?P<original>.*)=====\n(?P<replacement>.*)>>>>>\n)$/s"
},
"goimports": {
"type": "goimports",
"include": [
"(\\.go$)"
]
},
"golangci-lint": {
"type": "golangci-lint",
"include": [
"(\\.go$)"
],
"flags": [
"--timeout=5m0s",
"--out-format=checkstyle"
"--output.checkstyle.path=stdout"
]
},
"jshint-ui": {
Expand Down
101 changes: 58 additions & 43 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
---
version: "2"
run:
# Tell golangci-lint to not acquire a lock because
# arcanist will run multiple instances in parallel.
allow-parallel-runners: true
# arcanist runs many of these in parallel causing
# CPU contention and longer runtimes.
timeout: 3m

output:
sort-results: true

issues:
max-issues-per-linter: 0
max-same-issues: 0
# TODO(ddelnano): Remove once typecheck is upgraded in next golangci-lint upgrade
# This error originates from the stdlib due to generics usage
exclude-rules:
- path: .*slices\/sort.go
linters:
- typecheck
text: "^(undefined: (min|max))"

linters:
enable:
- asciicheck
- errcheck
# Although goimports includes gofmt, it doesn't support the simplify option.
# So we include gofmt here.
- gofmt
- gosimple
- govet
- ineffassign
- makezero
Expand All @@ -39,24 +16,62 @@ linters:
- predeclared
- revive
- staticcheck
# https://github.com/golangci/golangci-lint/issues/2649
# - structcheck
- typecheck
- unused
# https://github.com/golangci/golangci-lint/issues/2649
# - wastedassign
- whitespace
Comment thread
ddelnano marked this conversation as resolved.
disable:
# The following linters are run separately by arcanist at the moment.
# This is because we have autofix hooks for these linters.
- goimports
disable-all: false

linters-settings:
errcheck:
# yamllint disable-line rule:line-length
ignore: io:Close,github.com/fatih/color,github.com/spf13/pflag:MarkHidden,github.com/spf13/viper:(BindEnv|BindPFlag),github.com/spf13/cobra:(Help|MarkFlagRequired|Usage),github.com/segmentio/analytics-go/v3:Enqueue,database/sql:Rollback,github.com/nats-io/nats.go:Unsubscribe
goimports:
local-prefixes: px.dev
nakedret:
max-func-lines: 0
settings:
errcheck:
Comment thread
ddelnano marked this conversation as resolved.
exclude-functions:
- io.Close
- (*github.com/spf13/pflag.FlagSet).MarkHidden
- github.com/spf13/viper.BindEnv
- github.com/spf13/viper.BindPFlag
- github.com/spf13/viper.BindPFlags
- (*github.com/spf13/cobra.Command).Help
- (*github.com/spf13/cobra.Command).MarkFlagRequired
- (*github.com/spf13/cobra.Command).Usage
- (github.com/segmentio/analytics-go/v3.Client).Enqueue
- (*database/sql.Tx).Rollback
- (*github.com/nats-io/nats.go.Subscription).Unsubscribe
revive:
rules:
- name: unused-parameter
disabled: true
staticcheck:
checks:
- all
- "-ST1005" # ignore the "ST1005: error strings should not be capitalized" check
- "-QF1008" # ignore omit embedded fields from selector expression
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofumpt
Comment thread
ddelnano marked this conversation as resolved.
settings:
gci:
sections:
- standard
- default
- prefix(px.dev)
custom-order: true
goimports:
local-prefixes:
- px.dev
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
8 changes: 4 additions & 4 deletions docker.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOCKER_IMAGE_TAG=202502242148
LINTER_IMAGE_DIGEST=eb7613e8aab9eb4620d6fae2618c966092abca8734abf90f0238db7de4535f15
DEV_IMAGE_DIGEST=8316e718b16de940e2a5ac64fb6e57dc9ed28ca2ed437302e339964e9b42c9f2
DEV_IMAGE_WITH_EXTRAS_DIGEST=b6d4c2404b30d06c2322d531620dcbe810a2c534f1cd0aa2389c75ed91d9bc24
DOCKER_IMAGE_TAG=202504121153
LINTER_IMAGE_DIGEST=ff369d95c4c84c95b668498219fda60ff8126828839171262f2eee58bd95ce19
DEV_IMAGE_DIGEST=91e7fb85e0497340df5efaf035b65d98eab458908f852a782aeeb5ea0b69b5c9
DEV_IMAGE_WITH_EXTRAS_DIGEST=f90e8b9b69d5870a7115ad434388da7bcef05f4a6c47e937a5a6348a22613ab4
7 changes: 2 additions & 5 deletions src/api/go/pxapi/examples/basic_example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ import (
"px.dev/pixie/src/api/go/pxapi/types"
)

var (
pxl = `
var pxl = `
import px
df = px.DataFrame('http_events')
df = df[['upid', 'req_path', 'remote_addr', 'req_method']]
df = df.head(10)
px.display(df, 'http')
`
)

type tablePrinter struct{}

Expand All @@ -56,8 +54,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
return nil
}

type tableMux struct {
}
type tableMux struct{}

func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
return &tablePrinter{}, nil
Expand Down
7 changes: 2 additions & 5 deletions src/api/go/pxapi/examples/encryption_example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ import (
"px.dev/pixie/src/api/go/pxapi/types"
)

var (
pxl = `
var pxl = `
import px
df = px.DataFrame('http_events')
df = df[['upid', 'req_path', 'remote_addr', 'req_method']]
df = df.head(10)
px.display(df, 'http')
`
)

type tablePrinter struct{}

Expand All @@ -56,8 +54,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
return nil
}

type tableMux struct {
}
type tableMux struct{}

func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
return &tablePrinter{}, nil
Expand Down
4 changes: 1 addition & 3 deletions src/api/go/pxapi/examples/example_mux/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ import (
"px.dev/pixie/src/api/go/pxapi/types"
)

var (
pxl = `
var pxl = `
import px
df = px.DataFrame('http_events')
df = df[['upid', 'req_path', 'remote_addr', 'req_method']]
df = df.head(10)
px.display(df, 'http_as_json')
px.display(df, 'http_as_table')
`
)

func main() {
apiKey, ok := os.LookupEnv("PX_API_KEY")
Expand Down
4 changes: 2 additions & 2 deletions src/api/go/pxapi/examples/standalone_pem_example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type tablePrinter struct{}
func (t *tablePrinter) HandleInit(ctx context.Context, metadata types.TableMetadata) error {
return nil
}

func (t *tablePrinter) HandleRecord(ctx context.Context, r *types.Record) error {
for _, d := range r.Data {
fmt.Printf("%s ", d.String())
Expand All @@ -103,8 +104,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
}

// Satisfies the TableMuxer interface.
type tableMux struct {
}
type tableMux struct{}

func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
return &tablePrinter{}, nil
Expand Down
7 changes: 2 additions & 5 deletions src/api/go/pxapi/examples/streaming_example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ import (
"px.dev/pixie/src/api/go/pxapi/types"
)

var (
pxl = `
var pxl = `
import px
df = px.DataFrame('http_events', start_time='-5m')[['resp_status','req_path']]
px.display(df.stream(), 'http_table')
`
)

type tablePrinter struct{}

Expand All @@ -54,8 +52,7 @@ func (t *tablePrinter) HandleDone(ctx context.Context) error {
return nil
}

type tableMux struct {
}
type tableMux struct{}

func (s *tableMux) AcceptTable(ctx context.Context, metadata types.TableMetadata) (pxapi.TableRecordHandler, error) {
return &tablePrinter{}, nil
Expand Down
1 change: 0 additions & 1 deletion src/api/go/pxapi/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ func (s *ScriptResults) run() error {
ctx := s.c.Context()
for {
resp, err := s.c.Recv()

if err != nil {
if err == io.EOF {
// Stream has terminated.
Expand Down
1 change: 0 additions & 1 deletion src/api/go/pxapi/vizier.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"context"

"px.dev/pixie/src/api/go/pxapi/errdefs"

"px.dev/pixie/src/api/proto/vizierpb"
)

Expand Down
7 changes: 5 additions & 2 deletions src/carnot/docstring/pkg/docstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (w *parser) ArgMatch(s string) bool {

return allRe.MatchString(s) && w.isTabbedLine(s)
}

func (w *parser) ReturnMatch(s string) bool {
allRe := re.MustCompile(w.ReturnReStr())

Expand Down Expand Up @@ -373,8 +374,10 @@ func parseDocstring(docString string) (*FunctionDocstring, error) {
return p.parsedDoc, nil
}

const topicRegex = `:topic: (?P<topic>[^\s]*)\n`
const opnameRegex = `:opname: (?P<opname>.*)\n`
const (
topicRegex = `:topic: (?P<topic>[^\s]*)\n`
opnameRegex = `:opname: (?P<opname>.*)\n`
)

// getTag finds the tag in the docstring if it exists.
func getTag(docstring, tagRegex string) string {
Expand Down
4 changes: 1 addition & 3 deletions src/carnot/docstring/tables/datatables.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ import (
"px.dev/pixie/src/shared/services"
)

var (
pxl = `
var pxl = `
import px
px.display(px.GetTables(), 'table_desc')
px.display(px.GetSchemas(), 'table_schemas')
`
)

func init() {
pflag.String("cluster_id", "", "The cluster_id of the cluster to query")
Expand Down
2 changes: 1 addition & 1 deletion src/carnot/goplanner/logical_planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ package goplanner
// #include <stdlib.h>
// #include "src/carnot/planner/cgo_export.h"
import "C"

import (
"errors"
"fmt"
"unsafe"

"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/types"

// Blank Import required by package.
_ "github.com/ianlancetaylor/cgosymbolizer"

Expand Down
3 changes: 2 additions & 1 deletion src/carnot/goplanner/logical_planner_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ const pxClusterJSON = `
]
}
`

const pxPodPxl = `
'''Pod Overview

Expand Down Expand Up @@ -1290,7 +1291,6 @@ func setupPlanner() (*goplanner.GoPlanner, error) {

func benchmarkPlannerInnerLoop(c *goplanner.GoPlanner, queryRequestPB *plannerpb.QueryRequest) {
plannerResultPB, err := c.Plan(queryRequestPB)

if err != nil {
log.Fatalln("Failed to plan:", err)
os.Exit(1)
Expand All @@ -1302,6 +1302,7 @@ func benchmarkPlannerInnerLoop(c *goplanner.GoPlanner, queryRequestPB *plannerpb
os.Exit(1)
}
}

func benchmarkPlanner(b *testing.B, queryRequestPB *plannerpb.QueryRequest, numAgents int) {
// Create the compiler.
c, err := setupPlanner()
Expand Down
3 changes: 1 addition & 2 deletions src/carnot/goplanner/logical_planner_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import (
var errorUnimplemented = errors.New(" ¡UNIMPLEMENTED STUB FOR STATIC ANALYSIS. goplanner ONLY RUNS WITH __CGO__ ENABLED! ")

// GoPlanner wraps the C Planner.
type GoPlanner struct {
}
type GoPlanner struct{}

// New creates a new GoPlanner object.
func New(udfInfo *udfspb.UDFInfo) (GoPlanner, error) {
Expand Down
3 changes: 0 additions & 3 deletions src/carnot/goplanner/logical_planner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ func TestPlanner_Simple(t *testing.T) {
LogicalPlannerState: plannerStatePB,
}
plannerResultPB, err := c.Plan(queryRequestPB)

if err != nil {
log.Fatalln("Failed to plan:", err)
os.Exit(1)
Expand Down Expand Up @@ -197,7 +196,6 @@ func TestPlanner_MissingTable(t *testing.T) {
LogicalPlannerState: plannerStatePB,
}
plannerResultPB, err := c.Plan(queryRequestPB)

if err != nil {
log.Fatalln("Failed to plan:", err)
os.Exit(1)
Expand Down Expand Up @@ -234,7 +232,6 @@ func TestPlanner_EmptyString(t *testing.T) {
LogicalPlannerState: plannerStatePB,
}
plannerResultPB, err := c.Plan(queryRequestPB)

if err != nil {
t.Fatal("Failed to plan:", err)
}
Expand Down
Loading
Loading