Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lint] Update to Cadence v1.2.1 #439

Merged
merged 4 commits into from
Oct 22, 2024
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 lint/analyzers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"

"github.com/onflow/cadence-tools/lint"
Expand Down Expand Up @@ -87,7 +87,7 @@ func testAnalyzersAdvanced(

var diagnostics []analysis.Diagnostic

programs[testLocation].Run(
programs.Get(testLocation).Run(
analyzers,
func(diagnostic analysis.Diagnostic) {
diagnostics = append(diagnostics, diagnostic)
Expand Down
6 changes: 3 additions & 3 deletions lint/cadence_v1_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package lint

import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
8 changes: 4 additions & 4 deletions lint/cadence_v1_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/errors"
"github.com/onflow/cadence/parser"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"

"github.com/onflow/cadence-tools/lint"
Expand Down
2 changes: 1 addition & 1 deletion lint/deprecated_member_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"regexp"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
2 changes: 1 addition & 1 deletion lint/deprecated_member_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package lint_test
import (
"testing"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/tools/analysis"
"github.com/stretchr/testify/require"

Expand Down
4 changes: 2 additions & 2 deletions lint/diagnostic.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package lint

import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
6 changes: 3 additions & 3 deletions lint/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ toolchain go1.22.3

require (
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/onflow/cadence v1.0.0
github.com/onflow/flow-go-sdk v1.0.0
github.com/onflow/cadence v1.2.1
github.com/onflow/flow-go-sdk v1.2.2
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.63.2
)
Expand All @@ -29,7 +29,7 @@ require (
github.com/logrusorgru/aurora/v4 v4.0.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/onflow/atree v0.8.0-rc.6 // indirect
github.com/onflow/atree v0.8.0 // indirect
github.com/onflow/crypto v0.25.1 // indirect
github.com/onflow/flow/protobuf/go/flow v0.4.7 // indirect
github.com/onflow/go-ethereum v1.13.4 // indirect
Expand Down
12 changes: 6 additions & 6 deletions lint/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/onflow/atree v0.8.0-rc.6 h1:GWgaylK24b5ta2Hq+TvyOF7X5tZLiLzMMn7lEt59fsA=
github.com/onflow/atree v0.8.0-rc.6/go.mod h1:yccR+LR7xc1Jdic0mrjocbHvUD7lnVvg8/Ct1AA5zBo=
github.com/onflow/cadence v1.0.0 h1:bvT75F2LZJvDCBmmajAv7QLISK6Qp30FAKcSwqNNH+o=
github.com/onflow/cadence v1.0.0/go.mod h1:7wvvecnAZtYOspLOS3Lh+FuAmMeSrXhAWiycC3kQ1UU=
github.com/onflow/atree v0.8.0 h1:qg5c6J1gVDNObughpEeWm8oxqhPGdEyGrda121GM4u0=
github.com/onflow/atree v0.8.0/go.mod h1:yccR+LR7xc1Jdic0mrjocbHvUD7lnVvg8/Ct1AA5zBo=
github.com/onflow/cadence v1.2.1 h1:hmSsgX3rTsp2E5qTSl1JXINt8qepdRrHTwDSYqN5Nxs=
github.com/onflow/cadence v1.2.1/go.mod h1:fJxxOAp1wnWDfOHT8GOc1ypsU0RR5E3z51AhG8Yf5jg=
github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A=
github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/flow-go-sdk v1.0.0 h1:Ha4fQm1MMKsyaqMkQLCN3rA/yaQKG6DGwiIfx06j40c=
github.com/onflow/flow-go-sdk v1.0.0/go.mod h1:iZkW2IWieVUZKK06mQCxpjJzPDgS0VtGpTaP/rKu6J4=
github.com/onflow/flow-go-sdk v1.2.2 h1:F78Sq/VaExgtaQv739k06gnx2aIyLF5wVE0XwxFpmsc=
github.com/onflow/flow-go-sdk v1.2.2/go.mod h1:yhQ5+Sp2xWoCQ1fuRDswawTDQ0ng0z5nTkFVH82xL7E=
github.com/onflow/flow/protobuf/go/flow v0.4.7 h1:iP6DFx4wZ3ETORsyeqzHu7neFT3d1CXF6wdK+AOOjmc=
github.com/onflow/flow/protobuf/go/flow v0.4.7/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc=
Expand Down
11 changes: 7 additions & 4 deletions lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/pretty"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/pretty"
"github.com/onflow/cadence/tools/analysis"
"github.com/onflow/flow-go-sdk"
grpcAccess "github.com/onflow/flow-go-sdk/access/grpc"
Expand Down Expand Up @@ -285,7 +285,10 @@ func (l *Linter) analyze(
config *analysis.Config,
locations []common.Location,
) {
programs := make(analysis.Programs, len(locations))
programs := analysis.Programs{
Programs: make(map[common.Location]*analysis.Program, len(locations)),
// TODO: crypto contract elaboration
}

log.Println("Loading ...")

Expand Down Expand Up @@ -320,7 +323,7 @@ func (l *Linter) analyze(
analyzers := l.Config.Analyzers
if len(analyzers) > 0 {
for _, location := range locations {
program := programs[location]
program := programs.Get(location)
if program == nil {
continue
}
Expand Down
6 changes: 3 additions & 3 deletions lint/number_function_argument_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package lint

import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/common"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
2 changes: 1 addition & 1 deletion lint/number_function_argument_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package lint_test
import (
"testing"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/tools/analysis"
"github.com/stretchr/testify/require"

Expand Down
6 changes: 3 additions & 3 deletions lint/redundant_cast_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ package lint
import (
"fmt"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/errors"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
2 changes: 1 addition & 1 deletion lint/redundant_cast_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package lint_test
import (
"testing"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/tools/analysis"
"github.com/stretchr/testify/require"

Expand Down
4 changes: 2 additions & 2 deletions lint/unnecessary_force_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package lint

import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
2 changes: 1 addition & 1 deletion lint/unnecessary_force_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/tools/analysis"

"github.com/onflow/cadence-tools/lint"
Expand Down
4 changes: 2 additions & 2 deletions lint/unused_result_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package lint

import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/sema"
"github.com/onflow/cadence/tools/analysis"
)

Expand Down
2 changes: 1 addition & 1 deletion lint/unused_result_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/ast"
"github.com/onflow/cadence/tools/analysis"

"github.com/onflow/cadence-tools/lint"
Expand Down
Loading