Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ament_mypy: Exclude does not work as described and file discovery handling differs to mypy #519

Open
Flova opened this issue Feb 6, 2025 · 0 comments

Comments

@Flova
Copy link

Flova commented Feb 6, 2025

Currently, ament_mypy passes all files explicitly to mypy. There are a few issues with this approach.

First of all, there was #516 until recently (it is still present in jazzy etc.). The logic from #516 is already present in mypy if we pass it a directory, but ament_mypy passes all files individually, because some might be in a folder that is flagged with AMENT_IGNORE and need to be removed. Adding all files individually also disables the exclude feature in the mypy.ini. This is especially relevant since the ament_mypy exclude feature does not really work. Contrary to its help page, only whole directories can be excluded.

My suggestion would be to just pass the given path(s) to mypy without extracting any filenames. The AMENT_IGNORE can be handled by appending these directories to the native exclude parameter of mypy. Similarly, I would just pass the exclude parameter of ament_mypy through to mypy.

This would enable the usage of excludes in the .ini, excludes of files, the removal of the stub priority logic and filename discovery. In the end it is very confusing if e.g. the exclude doesn't work like it's described in the mypy docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant