strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Enable Ruff annotations checks

Open patrick91 opened this issue 2 years ago β€’ 10 comments

In #2476 we enabled a bunch of additional checks on Ruff, but I haven't enabled some that are probably more important for us, namely the ones for annotations. We'd like our library to be fully annotated 😊

We can enable all these checks one at the time:

  • [ ] ANN001
  • [ ] ANN002
  • [x] ANN003
  • [ ] ~ANN102~
  • [x] ANN201
  • [x] ANN202
  • [x] ANN204
  • [x] ANN205
  • [x] ANN206
  • [ ] ANN401

We can skip these checks on tests, it's nice to have tests type too, but it might take a lot of time 😊

Feel free to ask me any question for this, some of the annotations might be easy to add, some might not 😊

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

patrick91 avatar Jan 19 '23 11:01 patrick91

Annotations are disabled here: https://github.com/strawberry-graphql/strawberry/blob/main/pyproject.toml#L178-L187

To work on any of them, remove the line of the annotation and then run ruff . and see what you get 😊 Then you can work from there to add annotations :)

patrick91 avatar Jan 19 '23 11:01 patrick91

Hi @patrick91, I'm interested in contributing to this issue. Can you please assign this to me

Thank You.

hi @MadhuMPandurangi, I think it's fine to start a PR directly ☺️

Please do only one check at the time, enabling all of them at once will require a lot of work ☺️

patrick91 avatar Jan 20 '23 09:01 patrick91

OK, diving into ANN001. @patrick91 no expectations that you'll want to check a WIP but if you want to take a peek and verify I'm on the right path, might save us some time...

see here

Before: Screenshot 2023-01-27 at 8 19 49 PM

After: Screenshot 2023-01-27 at 8 19 40 PM

alexauritt avatar Jan 28 '23 04:01 alexauritt

@alexauritt yes, that looks good! Feel free to open a draft PR too if you want more feedback on specific lines 😊

patrick91 avatar Jan 28 '23 12:01 patrick91

@alexauritt it is also fine to have # noqa: ANN001 where it is quite complex to add annotations btw 😊 we can always do this in multiple PRs :)

patrick91 avatar Jan 28 '23 14:01 patrick91

I wanna work on ANN201, maybe it's better to make it with multiple PRs as there are 1387 errors, what do you think @patrick91

jad-haddad avatar Mar 06 '23 20:03 jad-haddad

@JadHADDAD92 yes, good idea!

patrick91 avatar Mar 07 '23 10:03 patrick91

tackled ANN001 and ANN002

alexauritt avatar Apr 01 '23 20:04 alexauritt

Should i choose any annotation and create a new pr?

Ambro17 avatar Jun 08 '23 15:06 Ambro17

May want to remove ANN102 from the list, since it is being deprecated.

brunodantas avatar May 27 '24 19:05 brunodantas