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] Remove [Cadence 1.0] from Cadence V1 Diagnostics #315

Merged
merged 1 commit into from
Mar 18, 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
4 changes: 1 addition & 3 deletions lint/cadence_v1_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
package lint

import (
"fmt"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/sema"
Expand Down Expand Up @@ -341,7 +339,7 @@ func (v *cadenceV1Analyzer) newDiagnostic(
return newDiagnostic(
v.program.Location,
v.report,
fmt.Sprintf("[Cadence 1.0] %s", message),
message,
ast.NewRangeFromPositioned(nil, position),
).WithCode(code).WithURL(docURL).WithCategory(CadenceV1Category)
}
Expand Down
22 changes: 11 additions & 11 deletions lint/cadence_v1_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `save` has been replaced by the new Storage API.",
Message: "`save` has been replaced by the new Storage API.",
Code: "C1.0-StorageAPI-Save",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#account-access-got-improved-55",
SuggestedFixes: []analysis.SuggestedFix{
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `linkAccount` has been replaced by the Capability Controller API.",
Message: "`linkAccount` has been replaced by the Capability Controller API.",
Code: "C1.0-StorageAPI-LinkAccount",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#capability-controller-api-replaced-existing-linking-based-capability-api-82",
SuggestedFixes: []analysis.SuggestedFix{},
Expand Down Expand Up @@ -172,7 +172,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `link` has been replaced by the Capability Controller API.",
Message: "`link` has been replaced by the Capability Controller API.",
Code: "C1.0-StorageAPI-Link",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#capability-controller-api-replaced-existing-linking-based-capability-api-82",
SuggestedFixes: []analysis.SuggestedFix{},
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `unlink` has been replaced by the Capability Controller API.",
Message: "`unlink` has been replaced by the Capability Controller API.",
Code: "C1.0-StorageAPI-Unlink",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#capability-controller-api-replaced-existing-linking-based-capability-api-82",
SuggestedFixes: []analysis.SuggestedFix{},
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `getCapability` has been replaced by the Capability Controller API.",
Message: "`getCapability` has been replaced by the Capability Controller API.",
Code: "C1.0-CapabilityAPI-GetCapability",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#capability-controller-api-replaced-existing-linking-based-capability-api-82",
SuggestedFixes: []analysis.SuggestedFix{
Expand Down Expand Up @@ -329,7 +329,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `getLinkTarget` has been replaced by the Capability Controller API.",
Message: "`getLinkTarget` has been replaced by the Capability Controller API.",
Code: "C1.0-CapabilityAPI-GetLinkTarget",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#capability-controller-api-replaced-existing-linking-based-capability-api-82",
SuggestedFixes: []analysis.SuggestedFix{},
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `addPublicKey` has been removed in favour of the new Key Management API. Please use `keys.add` instead.",
Message: "`addPublicKey` has been removed in favour of the new Key Management API. Please use `keys.add` instead.",
Code: "C1.0-KeyAPI-AddPublicKey",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#capability-controller-api-replaced-existing-linking-based-capability-api-82",
SuggestedFixes: []analysis.SuggestedFix{},
Expand Down Expand Up @@ -418,7 +418,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `removePublicKey` has been removed in favour of the new Key Management API.\nPlease use `keys.revoke` instead.",
Message: "`removePublicKey` has been removed in favour of the new Key Management API.\nPlease use `keys.revoke` instead.",
Code: "C1.0-KeyAPI-RemovePublicKey",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#deprecated-key-management-api-got-removed-60",
SuggestedFixes: []analysis.SuggestedFix{
Expand Down Expand Up @@ -514,7 +514,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `destroy` keyword has been removed. Nested resources will now be implicitly destroyed with their parent. A `ResourceDestroyed` event can be configured to be emitted to notify clients of the destruction.",
Message: "`destroy` keyword has been removed. Nested resources will now be implicitly destroyed with their parent. A `ResourceDestroyed` event can be configured to be emitted to notify clients of the destruction.",
Code: "C1.0-ResourceDestruction",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#force-destruction-of-resources-101",
SuggestedFixes: []analysis.SuggestedFix{
Expand Down Expand Up @@ -578,7 +578,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `AuthAccount` has been removed in Cadence 1.0. Please use an authorized `&Account` reference with necessary entitlements instead.",
Message: "`AuthAccount` has been removed in Cadence 1.0. Please use an authorized `&Account` reference with necessary entitlements instead.",
Code: "C1.0-AuthAccount",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#account-access-got-improved-55",
SuggestedFixes: []analysis.SuggestedFix{
Expand Down Expand Up @@ -643,7 +643,7 @@ func TestCadenceV1Analyzer(t *testing.T) {
{
Location: testLocation,
Category: lint.CadenceV1Category,
Message: "[Cadence 1.0] `PublicAccount` has been removed in Cadence 1.0. Please use an `&Account` reference instead.",
Message: "`PublicAccount` has been removed in Cadence 1.0. Please use an `&Account` reference instead.",
Code: "C1.0-PublicAccount",
URL: "https://forum.flow.com/t/update-on-cadence-1-0/5197#account-access-got-improved-55",
SuggestedFixes: []analysis.SuggestedFix{
Expand Down
Loading