tooltitude / support

Tooltitude Support
https://www.tooltitude.com
Other
21 stars 0 forks source link

Incorrect Reference Detection in Testdata #15

Closed brennanjl closed 1 year ago

brennanjl commented 1 year ago

Tooltitude Version:

OS Version: v0.24.5

VS Code Version: 1.79.2

Go Version: 1.19

Code Repository (if open source): closed source

What did you try to do?: Tooltitude does not detect variable names in testdata properly. In a testdata folders, I have a basic set of functions that loads some data into global structs from a JSON file in an init function. I have noted it doing two things improperly:

  1. In a package testdata_test, it falsely flags variables of shadowing declarations of other variables from the base package: Screenshot 2023-06-24 at 10 38 06 AM

  2. It does not recognize any fields from the value being imported from the tesdata to the testdata_test package. Shown is an example. In this example, I changed the variable name to not trigger the bug from case 1 (it does happen then as well): Screenshot 2023-06-24 at 10 41 31 AM

It's worth noting that the code compiles and runs fine, it purely seems to be an issue with tooltitude. However, this is also quite an uncommon case, as testdata packages usually do not have / need tests written.

Is there anything interesting in the tooltitude output channel? (should be open if you are reporting error from within VS Code): no

Steps to reproduce

Case 1:

Case 2:

tooltitude-support commented 1 year ago

Ok. Thanks fro the report. Will take a look as soon as I have time.

tooltitude-support commented 1 year ago

Overall, it looks like we don't handle *_test packages correctly. It looks like we are considering them as a part of the larger package.

brennanjl commented 1 year ago

Yeah. Ran into essentially case 2 again, but this time when using it in another package:

Screenshot 2023-06-24 at 11 31 15 AM

tooltitude-support commented 1 year ago

@brennanjl I fixed it. The fix will be available the next Friday. It's a more risky kind of change, so we want to test it well before releasing to users.

tooltitude-support commented 1 year ago

Closing it, since it's fixed.