To enable automatic checks (like code linting) beforey each commit it is advised to install pre-commit:
Install it to your environment:
~/ansible_nextcloud$ pip install pre-commit
(for more options see here)
Enable pre-commit within the repo:
~/ansible_nextcloud$ pre-commit install
(Optional) Run complete check once:
~/ansible_nextcloud$ pre-commit run --all-files