sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.51k stars 65 forks source link

Enabling Metrics #289

Closed avylove closed 1 year ago

avylove commented 1 year ago

Checklist

Description

According to this post, metrics can be enabled in VSCode by adding

metrics:
  enabled: true

This does seem to work, but now my other settings are ignored in the IDE, the cli complains (metrics -> enabled) unexpected key 'enabled' found, and my python_version setting gets ignored in the IDE.

Since this is an older post I looked to see if I could find updated documentation. I tried looking for a setting for the extension but didn't see one and setting quality_threshold didn't display the metrics, either.

Debug Information

IDE Version:

VSCode 1.71.2

Sourcery Version:

Sourcery 0.12.9 Sourcery-cli 0.12.10

Operating system and Version:

Fedora 36

reka commented 1 year ago

Hi @avylove ,

We're sorry, this post is outdated indeed. We'll correct it.

Currently, the metrics are active by default and the metrics.enabled config option doesn't exist anymore. If you remove this option from your config and you hover over a function in VSCode, you should see its code quality metrics:

avylove commented 1 year ago

So it seems the issue is a little different than I described. My .sourcery.yaml file only has these contents

refactor:
  python_version: '2.7'

With that I can not see the metrics. If I remove that and have a blank file, I can see the metrics. This seems like unexpected behavior.

Hellebore commented 1 year ago

@avylove I think the problem there is the '2.7' - we don't support Python 2.

Our refactorings/metrics all have a sort of in-built default minimum Python version of >= 3.3, so specifying anything lower than that means they will not show up. We should certainly be more explicit about this in our documentation if it isn't clear.

avylove commented 1 year ago

Ah, I see. Setting it for 3.3 did the trick.