Skip to content

Commit

Permalink
[BEAM-14371] (and BEAM-14372) - enable a couple staticchecks (#17670)
Browse files Browse the repository at this point in the history
  • Loading branch information
damccorm committed May 13, 2022
1 parent 66e85da commit 780ad62
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 28 deletions.
8 changes: 0 additions & 8 deletions sdks/go/pkg/beam/coder.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,3 @@ func schemaDec(t reflect.Type, in []byte) (T, error) {
}
return val, nil
}

func newSchemaCoder(t reflect.Type) (*coder.CustomCoder, error) {
c, err := coder.NewCustomCoder("schema", t, schemaEnc, schemaDec)
if err != nil {
return nil, errors.Wrapf(err, "invalid coder")
}
return c, nil
}
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/core/graph/fn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 unused functions/types are for tests

package graph

import (
Expand Down
5 changes: 3 additions & 2 deletions sdks/go/pkg/beam/core/runtime/exec/emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ type ReusableEmitter interface {
Value() interface{}
}

// ReusableEmitter is a resettable value needed to hold the implicit context and
// emit event time. It also has the ability to have a watermark estimator attached.
// ReusableTimestampObservingWatermarkEmitter is a resettable value needed to hold
// the implicit context and emit event time. It also has the ability to have a
// watermark estimator attached.
type ReusableTimestampObservingWatermarkEmitter interface {
ReusableEmitter
AttachEstimator(est *sdf.WatermarkEstimator)
Expand Down
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/core/runtime/genx/genx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 unused functions/types are for tests

package genx

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ type LogicalType struct {
identifier string
goT, storageT, argT reflect.Type
argV reflect.Value
toStorage, toGo func(value reflect.Value) reflect.Value
}

// ID is a unique identifier for the logical type.
Expand Down
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/core/runtime/graphx/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 unused functions/types are for tests

package schema

import (
Expand Down
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/core/runtime/graphx/serialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 unused functions/types are for tests

package graphx

import (
Expand Down
6 changes: 0 additions & 6 deletions sdks/go/pkg/beam/core/runtime/graphx/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1248,12 +1248,6 @@ func mustEncodeMultiEdgeBase64(edge *graph.MultiEdge) (string, error) {
}), nil
}

// makeBytesKeyedCoder returns KV<[]byte,A,> for any coder,
// even if the coder is already a KV coder.
func makeBytesKeyedCoder(c *coder.Coder) *coder.Coder {
return coder.NewKV([]*coder.Coder{coder.NewBytes(), c})
}

func edgeID(edge *graph.MultiEdge) string {
return fmt.Sprintf("e%v", edge.ID())
}
Expand Down
6 changes: 0 additions & 6 deletions sdks/go/pkg/beam/core/runtime/graphx/xlang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ func newComponents(ts []string) *pipepb.Components {
return components
}

func expectPanic(t *testing.T, err string) {
if r := recover(); r == nil {
t.Errorf("expected panic; %v", err)
}
}

func TestExpandedTransform(t *testing.T) {
t.Run("Correct PTransform", func(t *testing.T) {
want := newTransform("x")
Expand Down
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/core/runtime/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 unused functions/types are for tests

package runtime

import (
Expand Down
2 changes: 0 additions & 2 deletions sdks/go/pkg/beam/io/xlang/jdbcio/jdbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ var defaultClasspaths = map[string][]string{
"com.mysql.jdbc.Driver": []string{"mysql:mysql-connector-java:8.0.28"},
}

var autoStartupAddress string = xlangx.UseAutomatedJavaExpansionService(serviceGradleTarget)

// jdbcConfigSchema is the config schema as per the expected corss language payload
// for JDBC IO read and write transform.
type jdbcConfigSchema struct {
Expand Down
4 changes: 1 addition & 3 deletions sdks/go/pkg/beam/staticcheck.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@
# analysis tool. See https://staticcheck.io/docs/checks/ for descriptions of
# each check.

# TODO(BEAM-14371): Clean up instances of S1021 (merge variable declaration and assignment) and enable check
# TODO(BEAM-14372): Clean up instances of U1000 (unused fields, vars, functions) and enable check
checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023", "-SA1019", "-U1000", "-S1021"]
checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1022", "-ST1023", "-SA1019", "-S1021"]
3 changes: 3 additions & 0 deletions sdks/go/pkg/beam/transforms/sql/sqlx/sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//lint:file-ignore U1000 unused type options in ExpansionPayload struct is needed to maintain
// correct expected serialized payload

// Package sqlx contains "internal" SQL transform interfaces that are needed
// by the SQL expansion providers.
//
Expand Down

0 comments on commit 780ad62

Please sign in to comment.