Done
Details
Priority
MediumAssignee
Franck RupinFranck RupinReporter
Jesse SopelJesse SopelFix versions
Sprint
NoneStory Points
2Labels
Details
Details
Priority
Assignee
Franck Rupin
Franck RupinReporter
Jesse Sopel
Jesse SopelFix versions
Sprint
None
Story Points
2
Labels
Zendesk Support
Zendesk Support
Zendesk Support
Created November 9, 2023 at 3:12 PM
Updated January 10, 2024 at 7:17 PM
Resolved December 26, 2023 at 12:40 PM
The next step would hopefully be to add some more interesting hooks. A few were proposed last year in WAZO-2984. Whilst some projects can have some extra ones depending on needs, it would be good to agree on some basic ones that should be in most repos.
Personally, I believe
isort
andpyupgrade
would be the most important to start with.pyupgrade
has (normally) already been run on all repos since the migration to Python 3.9, but it will ensure we avoid adding any old syntax or deprecated features to new code. And isort will automatically sort and group imports for us so we can actually follow our coding style rules. Basic checks on files like yaml, json and toml just to ensure syntax is valid and eof- and trailing whitespace would be nice too.Linters for docker files and markdown would be nice, but I think we would have too many errors for now.
I think the copyright check would be essential too, that way we would no longer depend on legacy hooks. It has already been modified to support pre-commit, but in order to avoid versioning warnings we might want to add tags to the repo or move the git hooks to another repository and version them there. Otherwise we will get warnings all the time.
So the proposition would be to add:
pyupgrade
isort
check-json, check-toml, check-yaml
wazo check-copyright
To all repos.
In parallel, I think we should continue adding mypy to as many repositories as possible.
An example config of this can be found int
Note: If you use pyupgrade on a repository that uses pydantic, FastAPI or other libraries where it will do runtime introspection of type hints, you might need to use the argument
--keep-runtime-typing
to ensure it does not automatically upgrade the types to newer syntax as it will cause errors when Python 3.9 tries to evaluate them