[Bug] Using code_metrics for a plugin that has an example app causes the Dart analysis server not to pickup on metrics analysis #253
Comments
@GroovinChip ah, here we go again! 😄 Have you tried open it in VS Code or it's not possible? And could you please do the same steps, that we went through here? |
If VS Code will work fine, then I will start debugging from Android Studio right away. |
Here we go again indeed! 😅 I actually already made sure to exclude the iOS folder, and I made sure that my member ordering rule has the correct indentation. VS code is also not showing any metrics. I think it's because the plugin isn't running. The analysis server diagnostics say that it cannot resolve code metrics for the example app, and so it is not running, which prompted me to file this 😅 I didn't want to bother you guys again, which is why I tried a bunch of things on my own based on previous help you've provided, but no luck 😅 Edit: I'm using version 3.0.0-nullsafety.1 btw |
No problem, let's try to make it work! Do I understand you correctly, that:
And I have some additional questions:
|
Excellent, thank you!
No, it doesn't work at all, and the diagnostics say that it's because it cannot resolve the code metrics package at the example's path.
This is indeed something I tried, and while it resolved the diagnostics error, metrics were still not appearing at all. So I rolled back to only using it in the plugin.
None
The cli has worked the whole time, but the dart analysis server in IDE's is not picking up code metrics analysis
As in, completely remove the example from the plugin project? |
Hmm, that's look very interesting then...
So, now you have two pubspecs and the root one is depending on a dart_code_metrics, right? Great, that cli works, it means that files are parsed correctly and it's not an issue with the analyzer file resolving. Could you please double check that you passed the analyzer:
plugins:
- dart_code_metrics
Yeah, I'm very curious, will that help or not. |
Yes, two pubspecs - the plugin pubspec and the example app pubspec, and code metrics is a dev dependency in the plugin pubspec.
Yes, the plugin analysis_options.yaml is configured this way., although without empty lines in between analyzer, plugins, and dart_code_metrics
I'll try this and report back. |
Update: deleting the example resolves the error shown previously in the analysis server diagnostics, but metrics are still to appearing in the ide after a restart. |
Update: after invalidating caches and restarting, the analysis server diagnostics say code metrics is not running for an unknown reason. I've restored the example after this. Oddly, now the analysis server shows the code metrics associated with the plugin and example contexts, with no metrics appearing the ide. But I have not yet restarted the ide or the analysis server. Doing so now. Edit: restarting the analysis server brings the error back |
Hm, I think I need some time to think about this... If you will be able to create an example where the issue can be reproduced - it will be very very helpful. |
I'll see if I can recreate this on my personal computer. Should I update this to be a bug issue? I filed it as a question because I wasn't sure if it was user error or not. |
Yeah, looks like a bug to me... Is it a full stacktrace or there is more? If there is more, can u share a full log? Edit: and I don't think that this is a problem with a package having an example. |
OK, I'll update the issue. Hm, I thought I had captured the full log but there are actually about 20 more lines. Stand by for the rest. |
Thanks! |
Issue reproduced here: https://github.com/GroovinChip/code_metrics_repro1 Logs are in the readme Oddly, the creation of this project has resulted in #220 reappearing in that same project O_O |
@incendial Restarting the analyzer seems to resolve #220 again for that project |
@GroovinChip some updates from my side - 2.4.1 version works as expected, although there is also this error with And if I try to update the version to null safety, then plugin seems to work fine, but no issues in IDE. |
Strange. I did try and downgrade to 2.4.1 (not in the repro) but couldn't due to dependency conflicts, so I can't say if that would work for me or not, but since you still got the error anyway it probably wouldn't work. |
@GroovinChip we finally found the problem, actually two problems 😄 . First one is connected with our migration - analysis options file was not located correctly which resulted in that strange behaviour where the plugin was working correctly, but no files were processed. Second one is about Edit: the link to the discussion about analyzer_plugin issue. Link to our side fix: #255 |
Hope, we will be able to fix it soon. |
@incendial using #255 results in the following diagnostics:
|
@GroovinChip yeah, that is actually the second problem I was talking about. Should be resolved after updating dependency constraints here #259 |
@GroovinChip try to use 3.0.0-nullsafety.2 version |
The error with |
@dkrutskikh This seems to do the trick for now, thanks. Fingers crossed it stays that way! |
Seems like we resolved the main problem with the plugin bootstrapping and the problem with |
At work, I develop and maintain a Flutter plugin and I added code metrics to it yesterday. I configured it as I normally do. However, metrics analysis doesn't show up in Android Studio's analyzer tab, and when I view the diagnostics it shows errors because of the example. So I tried two things, and while they solved the error, neither results in the metrics being shown in the ide:
Unfortunately, I cannot share any code or logs - GitHub is blocked on my work machine (I'm filing this on my phone) and the code is private.
I'd be very grateful for whatever insight you guys might have on this.
The text was updated successfully, but these errors were encountered: