Skip to content

Conversation

@CodeSimcoe
Copy link

Goal is to add a new inspection that reports non-existing target properties

image

@CodeSimcoe
Copy link
Author

I found an issue when using dotted . notation, will attempt to fix it

@filiphr
Copy link
Member

filiphr commented Mar 14, 2024

Thanks for your work on this @CodeSimcoe. Is it possible to report the error on the actual property in the Mapping#target directly? This way it would be immediately clear where the issue is.

@CodeSimcoe
Copy link
Author

CodeSimcoe commented Mar 14, 2024

That would be better indeed.
Also, this reporting could be extended to source attribute as well.

And as stated above, I still need to figure out some issues about attributes with dotted . notations like target="field1.field2.
I see this is managed for completion but I need to handle this as well here. Any help could be useful... is there a way to easily recursively get all attributes ?
I'll work on this when i get some time anyway.
Ty

@filiphr
Copy link
Member

filiphr commented Mar 16, 2024

I've been investigating this a bit and also exploring how IntelliJ is implementing some things like this. e.g. for JUnit's @MethodSource (https://github.com/JetBrains/intellij-community/blob/dff1750f6269d0a51ed4df6b3bc8ef0e9f931e61/plugins/junit/src/com/intellij/execution/junit/codeInspection/JUnitMalformedDeclarationInspection.kt#L539). Seems like we can do resolving here. Perhaps we need to rely on that. Maybe even look into using PsiPolyVariantReference for our source and target references.

@CodeSimcoe
Copy link
Author

For a starter, we could only check base target. That is not exhaustive, but that's still better than nothing, most error cases would be raised (this often happens to me during refactors and I only get the error when compiling...).
I also moved the error to the attribute itself

image

@CodeSimcoe CodeSimcoe changed the title Report Non-existing target properties as errors Report Non-existing target/source properties as errors Mar 29, 2024
@filiphr
Copy link
Member

filiphr commented Jan 18, 2025

Closing this in favor of #213. Thanks for your work on this @CodeSimcoe.

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.

2 participants