cvxpy icon indicating copy to clipboard operation
cvxpy copied to clipboard

Fix all public functions that do not have return type annotations

Open sunnygurm opened this issue 2 years ago • 2 comments

Describe the bug While getting familiar with the repository and codebase, I ran ruff check --select ANN201 ./cvxpy to see how many issues existed relating to return type annotations for public functions.

There are 930 such instances as of today (Dec 14 2023).

More details for ANN201 errors and why it might be good to fix them can be found here.

To Reproduce See output logs of ruff check --select ANN201 ./cvxpy

Expected behavior ruff check --select ANN201 ./cvxpy should not return any errors

Output N/A

Version N/A

Additional context See this PR for additional context.

A proposed approach to cut down on these errors could be:

  • Pick a directory that has these errors
  • Fix the issues in that directory; submit a tightly scoped PR (IMHO I don't think 'tackling all 900 errors at once' is a good approach because it would blow up the scope and review time of the PR)

This is a really good 'first issue' for someone getting familiar with the repository.

sunnygurm avatar Dec 14 '23 23:12 sunnygurm

Hi @sunnygurm thank you for opening this issue. I was wondering if it would be possible to check for missing return type annotations automatically in future commits? (using pre-commit). Perhaps it would be a better idea to add that after all 930 such instances have been resolved.. :). But imo it could be nice to catch that as an error for future commits.

Transurgeon avatar Dec 16 '23 22:12 Transurgeon

@Transurgeon agreed! I think once we're in good shape we can add this check to the pre-commit hook.

sunnygurm avatar Dec 17 '23 19:12 sunnygurm