Skip to content

fix(imports): recognize only Cadence source file paths - #2368

Open
davidwoood wants to merge 1 commit into
onflow:masterfrom
davidwoood:my_feature
Open

davidwoood wants to merge 1 commit into
onflow:masterfrom
davidwoood:my_feature

Conversation

@davidwoood

Copy link
Copy Markdown

Closes #ISSUE

Description

IsPathLocation used substring matching for .cdc, so Example.cdc.backup and contracts.cdc/Example were treated as Cadence source paths. Check the path extension instead and cover valid/invalid cases in TestIsPathLocation.

For contributor use:

  • Target master and follow the Go style guide.
  • Link the accepted issue or spec before opening.
  • Reviewed the changed files; added regression cases.
  • go test ./internal/util -run TestIsPathLocation -count=1 passed.

Signed-off-by: davidwoood <pengzhujianren@outlook.com>
@davidwoood
davidwoood requested a review from a team as a code owner November 9, 2026 02:10
@davidwoood

Copy link
Copy Markdown
Author

@SupunS Could you please take a look at this fix, or let me know if a tracking issue is required first?

IsPathLocation previously used substring matching, which incorrectly recognized paths like Example.cdc.backup as Cadence source files.

The PR switches to extension checking and adds regression tests. The targeted Go tests passed.

Happy to make any adjustments. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant